Skip to content

Instantly share code, notes, and snippets.

@dmitric
Created October 10, 2012 05:32
Show Gist options
  • 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