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
2
votes
2 answers

NSRegularExpression doesn't match

I'm making a regular expression for the following line: Table 'Joella VIII' 6-max Seat #4 is the button So far, I've got this: self.tableDetailsRegex = [NSRegularExpression regularExpressionWithPattern:@"Table '[A-Za-z0-9 ]*' [0-9]+-max Seat…
Sander Declerck
  • 2,455
  • 4
  • 28
  • 38
2
votes
1 answer

How to use Regular Expression with NSPredicates?

In my app, I am trying to find list of strings which starts with any of the special characters(*,~,",().I want to use NSPredicate to find the these strings but I do not know what regular expression to create and use.Even I do not know how to use…
Nuzhat Zari
  • 3,398
  • 2
  • 24
  • 36
2
votes
2 answers

Basic regex expression

I'd like to replace angle brackets and spaces in a string. For example @"< something >" goes to @"something". I'm currently trying: NSString *s1 = @"< something >"; NSString *s2 = [s1 stringByReplacingOccurrencesOfString:@"[<> ]" …
MrDatabase
  • 43,245
  • 41
  • 111
  • 153
2
votes
2 answers

NSRegularExpression for retrieving numbers from a string

I had used NSScanner for retrieving numbers from below text. But sometimes the result is not like what is expected. Heard that NSRegularExpression class which is available fro iOS 4 is better to do this type of extraction. As I am a beginner on…
isarathg
  • 858
  • 1
  • 19
  • 37
2
votes
1 answer

The given key was not present in the dictionary Match Evaluator delegate

I'm trying to replace a string with regex via Match Evaluator delegate. [dictionary method] when the string starts with: .- &*?. I get a error with the following details: the given key was not present in the dictionary. What can I…
Jakob
  • 27
  • 4
2
votes
1 answer

How to Ignore all folders with folder pattern using prettier

When I execute the following command in a root folder of a project, all the files recursively get run as I expect. prettier --write "**/*.{js,ts}" However, I want to ignore all folders that start with ./next or ./old in those subfolders. How can I…
Pete
  • 3,111
  • 6
  • 20
  • 43
2
votes
1 answer

Regular expression to disallow empty string and comma

I'm trying to write regular expression to restrict empty string and comma inside a string example: string = "" # not allowed s = "ab c!@#)(*&^%$#~" # allowed s = "sfsfsf,sdfsdf" # not allowed The intention of this regexp is to do a pattern matching…
2
votes
1 answer

How to do not allow certain characters duplicated using Regex

only one letter can be written/selected as value, excepted for I, O, Q, S, X, Y, Z. I've tried : String regex="^(?!.*(.).*\1)([ABCDEFGHJKLMNPTURVW])+$|((?!OIXZYQS).)+$"
2
votes
1 answer

NSRegularExpression problem for newbie

i am a regular expression newbie. I have a working code using nsregularexpression. i am modifying it a little. __nameRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"^\\w+" options:NSRegularExpressionCaseInsensitive…
sununest
  • 65
  • 1
  • 7
2
votes
1 answer

Regex array of named group matches

I would like to get an array of all captured group matches in chronological order (the order they appear in in the input string). So for examples with the following regex: (?Pfoo)|(?Pbar) and the following input: foo bar foo I…
Jomy
  • 514
  • 6
  • 22
2
votes
1 answer

Problem with regex detecting $

I am trying to detect the following expression: $ for example $john or $mike What is wrong with my regex? //Check for $symbol NSRegularExpression *symbolRegex = [[NSRegularExpression alloc] initWithPattern:@"($[a-zA-Z0-9_]+)" …
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
2
votes
1 answer

Need help to solve the function haskell regex manipulation function

The definition firsts :: RE sym -> [sym] firsts = undefined The RE data data RE sym -- sym is type of alphabet symbols = RSym sym -- match single symbol | REps -- match empty string | RZero -- match nothing | RStar (RE sym) --…
2
votes
2 answers

Need to extract String in between strings using REGEXEXTRACT() in Google Sheet

I have a string like this patern: "abcd abcd | abcde | Degree SP | xyz abcd | abcd ABC" I need to extract "Degree SP" using regular expressions. How can I do that? The condition here are: string end with "SP " string start after last "|". I'm…
2
votes
1 answer

regular expression for numbers without their end character that connect to them

I need regular expression for numbers that can be negative, with commas or decimal. For examples: 12 +12 -12.0 -12,345.5466 +12,345,678,678 0.154 But not pass: "500." or "500,". I want that 500 will return as a number without the point or the…
2
votes
2 answers

Azure Security center giving high alerts "trusted registries only allowed for container images"

We have AKS and using images from our private acr and dockerhub images. Could see that default security policies applied to the subscription and which giving high security vulnerabilities recommendations for the trusted images. Upon checking…
Vowneee
  • 956
  • 10
  • 33