NSString *str = @"13511112222";
NSString *regex = @"[0-9]{11}";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
BOOL isMatch = [pred evaluateWithObject:str];
这个isMatch就是判断结果啦~
NSString *str = @"13511112222";
NSString *regex = @"[0-9]{11}";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
BOOL isMatch = [pred evaluateWithObject:str];
这个isMatch就是判断结果啦~
本文标题:正则表达式判断手机号
本文链接:https://www.haomeiwen.com/subject/xfvilttx.html
网友评论