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