NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)" options:NSRegularExpressionCaseInsensitive error:&error];
工作本身的代码,但给出了这样的警告:
"Unknown escape sequence \."
我也尝试过的选项:
NSRegularExpressionCaseInsensitive|NSRegularExpressionAnchorsMatchLines
但仍错误仍然存在。任何人都可以解释为什么会出现这个错误以及如何删除它。
请参阅http://stackoverflow.com/questions/6812206/unknown-escape-sequence-regular-expression – 2012-04-23 10:27:29