小编Iza*_*Mac的帖子

NSRegularExpression发出警告

这是代码

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];
Run Code Online (Sandbox Code Playgroud)

代码本身有效,但会发出以下警告:

"Unknown escape sequence \." 
Run Code Online (Sandbox Code Playgroud)

我也尝试过这些选项:

NSRegularExpressionCaseInsensitive|NSRegularExpressionAnchorsMatchLines
Run Code Online (Sandbox Code Playgroud)

但仍然存在错误.任何人都可以解释为什么会出现此错误以及如何删除它.

regex iphone xcode objective-c nsregularexpression

1
推荐指数
1
解决办法
1175
查看次数

标签 统计

iphone ×1

nsregularexpression ×1

objective-c ×1

regex ×1

xcode ×1