Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Without this library
- NSString* string = @"I have 2 dogs.";
- NSRegularExpression *regex = [NSRegularExpression regular ExpressionWithPattern:@"\\d+" options:NSRegularExpressionCaseInsensitive error:&error];
- NSTextCheckingResult *match = [regex firstMatchInString:string options:0 range:NSMakeRange(0, [string length])];
- BOOL isMatch = match != nil;
- // With this library
- BOOL isMatch = [@"I have 2 dogs." isMatch:RX(@"\\d+")];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement