NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
if(!([tfContact.text isMatch:RX(@"1\\d{10}")]&&([tfContact.text length]==11)) && ![tfContact.text isMatch:RX(emailRegex)]){//验证手机号码和邮箱
[[[UIAlertView alloc] initWithTitle:@"提示" message:@"联系方式不正确" delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil] show];
return;
}
推荐阅读:
http://blog.csdn.net/dyllove98/article/details/8635079
网友评论