【发布时间】:2009-10-17 17:17:03
【问题描述】:
我在使用简单的 NSPredicates 和正则表达式时遇到问题:
NSString *mystring = @"file://questions/123456789/desc-text-here";
NSString *regex = @"file://questions+";
NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isMatch = [regextest evaluateWithObject:mystring];
在上面的示例中,isMatch 始终为 false/NO。
我错过了什么?我似乎找不到匹配 file://questions 的正则表达式。
【问题讨论】:
标签: objective-c regex cocoa nspredicate