Created
October 10, 2012 05:32
-
-
Save dmitric/3863349 to your computer and use it in GitHub Desktop.
How to make regular expressions in objC
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
static inline NSRegularExpression * TagRegularExpression() { | |
static NSRegularExpression *_tagRegularExpression = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_tagRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"\\#[\\w]+" | |
options:NSRegularExpressionCaseInsensitive | |
error:nil]; | |
}); | |
return _tagRegularExpression; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment