Questions tagged [nsregularexpression]

The NSRegularExpression class is used to represent and apply regular expressions to Unicode strings. An instance of this class is an immutable representation of a compiled regular expression pattern and various option flags. The pattern syntax currently supported is that specified by ICU. iOS 4.0+ macOS 10.7+

This class in the Apple developer library (Mac OS X, iOS) is used to represent and apply regular expressions to Unicode strings.

NOTE: This tag should be used only for questions specific to the NSRegularExpression class. Questions about regular expressions in general should be tagged .

722 questions
-1
votes
1 answer

Regex for string comparison with and without special characters

I'm trying create a regular expression for string comparison. The regular expression is: .*\bword.* However, I want to ignore special characters and the comparison should work with and without them. For example: O'Reilly should match O'Reilly and…
mrodriguez
  • 91
  • 12
-1
votes
1 answer

Creating a list of lists with regular expressions in python

I thought I had successfully created and filtered a list of lists using regular expression in python. However, when I attempt to index the lists I just index the first item in each of the lists. Upon closer inspection I noticed that I don't have any…
C. Brookes
  • 31
  • 5
-1
votes
2 answers

Regular Expressions C#: Clean bad Json string

I get an answer from the server in the form of such JSON: var zohozoho_atliview92 = {\"Itinerary\":[ {\"Client_Email\":\"garymc\", \"Client_Name\":\"Gary\", \"NT_Number\":\"NT-1237\",\"Number_of_Nights\":7, \"ID\":\"24297940\", …
Nikita Goncharuk
  • 795
  • 1
  • 8
  • 23
-1
votes
1 answer

Regular expression is not working properly in Swift 3

I am trying to parse string data in Swift, the best solution that I can think of is using a regular expression. The problem is with detecting a substring with the pattern {{...}} The ... represents a string of any length. I created a regular…
Zia ur Rehman
  • 331
  • 1
  • 2
  • 20
-1
votes
2 answers

Objective-C - How to use NSRegularExpression and regular expression to get a String Array

I am attempting to get my school's notification shown on app. Here is the source code of the HTML of notification.
Alex Li
  • 55
  • 1
  • 9
-1
votes
1 answer

Validate user-entered RegEx in cocoa

I have a predicate editor that allows the user to use "matches" for RegEx, thus they are entering a text string that is a RexEx used to search. If they enter something wrong, I get: Can't open pattern U_REGEX_RULE_SYNTAX (string /Volumes/[path to…
Trygve
  • 1,317
  • 10
  • 27
-1
votes
1 answer

NSArray of NSRegularExpressions in swift

The fork here has a custom link function but the implementation in the actual code is in objective C.This is the code line and her it is printed again: - (NSArray*)getRegularExpressions { return [NSArray…
Jacolack
  • 1,365
  • 2
  • 11
  • 25
-1
votes
1 answer

regex woes when searching for spaces

I'm trying, in vain, to create a regex string that accomplishes the following. In any given string: return true if the string is not made up of * and space characters. So ** is ok and **** **** ** is fine (the \n may not have come through the…
null
  • 3,469
  • 7
  • 41
  • 90
-1
votes
2 answers

Regular Expressions retrieve text between words with re-occurring pattern

I have the following Literal Text "value":"1001174227","fieldLabel":"A field"},{"value":"THE VALUE I NEED","fieldLabel":"Period"} My goal was to use regular expressions to extract the string THE VALUE I NEED I attempted to match using the regular…
Peter H
  • 871
  • 1
  • 10
  • 33
-1
votes
1 answer

My app closes when "return nil", how can I fix it? | Swift

I want to use regular expressions but I can`t class Regex { let pattern: String let internalExpression: NSRegularExpression init?(_ pattern: String) { do { self.internalExpression = try NSRegularExpression(pattern:…
Juanma M
  • 11
  • 5
-1
votes
1 answer

"Generic parameter 'Element' could not be inferred" error in swift...?

I am using the following class and it has method to extract all emails inside a string, I am new to swift and its giving me an error. Can someone please explain as to why this error is coming..? Thanks import UIKit import Foundation class…
Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115
-1
votes
1 answer

Working out a difficult case with NSRegularExpression

I am using the Swift Playground to experiment with NSRegularExpression and I do not get what I would like to. Here is my code: import UIKit let str = "qwun782h218gs634 AbCd56EfGh7ZsDe985\nXzSr519UkGe9823SdFg91nui uihiheg875d dss77ds", patn =…
Michel
  • 10,303
  • 17
  • 82
  • 179
-1
votes
1 answer

How to construct Regex pattern Swift

I am trying to construct Regex but it doesn't work. Can anyone help? I have a string, which I want to remove the following characters: *_-+=#:><&[]\n And instruct also to remove all text between (/ and ) Code is belkow: if let regex = try?…
Tal Zion
  • 6,308
  • 3
  • 50
  • 73
-1
votes
1 answer

RegularExpression to detect below text format: @<10|asdffdfs>@

I need to write a regular expression to replace string @@ to Text in my iOS application. @@ e.g. @<12|abcd>@ will be abcd @<1|I am a good boy>>>>>@ will be I am a good boy>>>> @@ no change, because the first part…
ZYiOS
  • 5,204
  • 3
  • 39
  • 45
-1
votes
1 answer

Email Regular expression issue while using special characters

I have created the following regular expression for validating my email - (BOOL)isValidEmail { BOOL stricterFilter = YES; NSString *stricterFilterString = @"[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}"; NSString *laxString =…
Umair Suraj
  • 480
  • 11
  • 22