小编Yoo*_*oot的帖子

电子邮件地址的正则表达式不起作用

我正在尝试使用以下代码检查某些电子邮件地址是否正确:

NSPredicate *regexMail = [NSPredicate predicateWithFormat:@"SELF MATCHES '.*@.*\..*'"];
if([regexMail evaluateWithObject:someMail])
... 
Run Code Online (Sandbox Code Playgroud)

但是"\".由于邮件"smith @ company"被接受,似乎没有用.此外,我有以下警告:"未知逃脱序列"

编辑:

我正在使用Objective-C for iPhone进行编程.

谢谢

regex email iphone objective-c nspredicate

2
推荐指数
2
解决办法
2300
查看次数

标签 统计

email ×1

iphone ×1

nspredicate ×1

objective-c ×1

regex ×1