NSPredicate and simple Regular Expression problem

Posted by rjstelling on Stack Overflow See other posts from Stack Overflow or by rjstelling
Published on 2009-10-17T17:17:03Z Indexed on 2010/03/31 11:23 UTC
Read the original article Hit count: 456

Filed under:
|
|
|

I'm having problems with simple NSPredicates and regular expressions:

NSString *mystring = @"file://questions/123456789/desc-text-here";
NSString *regex = @"file://questions+";

NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isMatch = [regextest evaluateWithObject:mystring];

In the above example isMatch is is always false/NO.

What am I missing? I can't seem to find a regular expression that will match file://questions.

© Stack Overflow or respective owner

Related posts about nspredicate

Related posts about regex