https://github.com/kgn/cocoaverbalexpression
https://github.com/kgn/cocoaverbalexpression
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kgn/cocoaverbalexpression
- Owner: kgn
- Created: 2013-08-05T19:07:19.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-08-05T19:17:29.000Z (almost 12 years ago)
- Last Synced: 2025-03-23T10:44:18.161Z (4 months ago)
- Language: Objective-C
- Size: 105 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Cocoa port of [VerbalExpressions](https://github.com/jehna/VerbalExpressions). Still very much in development, contributions welcome!
``` obj-c
VerbalExpression *verbalExpression = [VerbalExpression expression];
[verbalExpression whiteSpace];
[verbalExpression then:@"#"];
[verbalExpression somethingBut:[VerbalExpression number]];
[verbalExpression anyOf:[VerbalExpression word], [VerbalExpression number], @"-", @"_", nil];NSError *error = nil;
NSRegularExpression *regex =
[NSRegularExpression regularExpressionWithPattern:verbalExpression.pattern options:NSRegularExpressionCaseInsensitive error:&error];
NSArray *matches = [regex matchesInString:text options:0 range:NSMakeRange(0, text.length)];
for(NSTextCheckingResult *match in matches){
...
}
```