Skip to content

Instantly share code, notes, and snippets.

@dmitric
Created October 10, 2012 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitric/3863349 to your computer and use it in GitHub Desktop.
Save dmitric/3863349 to your computer and use it in GitHub Desktop.
How to make regular expressions in objC
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