常见的正则表达式

"email"=>'/^([.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-])+/',

"phone"=>'/^(([0-9]{2,3})|([0-9]{3}-))?((0[0-9]{2,3})|0[0-9]{2,3}-)?[1-9][0-9]{6,7}(-[0-9]{1,4})?$/',

"mobile"=>'/^1[0-9]{10}$/',

"url"=>'/^http:(\\/){2}[A-Za-z0-9]+.[A-Za-z0-9]+[\\/=?%-&_~`@\\[\\]\':+!]*([^<>\"\"])*$/',

"currency"=>'/^[0-9]+(\\.[0-9]+)?$/',

"number"=>'/^[0-9]+$/',

"zip"=>'/^[0-9][0-9]{5}$/',

"qq"=>'/^[1-9][0-9]{4,8}$/',

"integer"=>'/^[-+]?[0-9]+$/',

"integerpositive"=>'/^[+]?[0-9]+$/',

"double"=>'/^[-+]?[0-9]+(\\.[0-9]+)?$/',

"doublepositive"=>'/^[+]?[0-9]+(\\.[0-9]+)?$/',

"english"=>'/^[A-Za-z]+$/',

"chinese"=>'/^[\x80-\xff]+$/',

"username"=>'/^[A-Za-z0-9\x{4e00}-\x{9fa5}_]/u',

"nochinese"=>'/^[A-Za-z0-9_-]+$/',

作者:xuekebaba

链接:https://www.jianshu.com/p/dd7332d53206

來源:

著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

你可能感兴趣的:(常见的正则表达式)