Created
December 4, 2010 14:31
-
-
Save SquaredTiki/728216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *myString = @"NSString Is A Test for NSRegularExpression"; | |
NSError *error = NULL; | |
NSRegularExpression *regex = [NSRegularExpression | |
regularExpressionWithPattern:@"(NS|UI)+(\w+)" | |
options:NSRegularExpressionCaseInsensitive | |
error:&error]; | |
[regex enumerateMatchesInString:myString options:0 range:NSMakeRange(0, [myString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){ | |
NSLog(@"Text Range %@", match.range); | |
NSLog(@"Text %@", [myString substringWithRange:match.range]); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UI abhdf