Regex for an email address doesn't work

后端 未结 8 2118
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 22:32

I\'m trying to check if some email address is correct with the following code :

NSPredicate *regexMail = [NSPredicate predicateWithFormat:@\"SELF MATCHES \'.*@.*         


        
8条回答
  •  旧巷少年郎
    2021-02-04 23:11

    try putting double slash instead of one slash. that's what might the Unknown escape sequence mean.

    here is a website that can help you understand how to use regex: http://www.wellho.net/regex/java.html

    or just find the appropriate regex for email address here: http://regexlib.com/DisplayPatterns.aspx?cattabindex=0&categoryId=1

提交回复
热议问题