Home > php教程 > php手册 > 表单验证常用到正则表达式一览

表单验证常用到正则表达式一览

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:39:28
Original
1145 people have browsed it

匹配中文字符的正则表达式: [u4e00-u9fa5]
匹配双字节字符(包括汉字在内):[^x00-xff]
匹配空行的正则表达式: [s| ]*
匹配HTML标记的正则表达式:/.*1>|/
匹配首尾空格的正则表达式:(^s*)|(s*$)
匹配Email地址的正则表达式:w ([- .]w )*@w ([-.]w )*.w ([-.]w )*
匹配网址URL的正则表达式:^[a-zA-z] ://(\w (-\w )*)(\.(\w (-\w )*))*(\?\S*)?$
匹配帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
匹配国内电话号码:(d{3}-|d{4}-)?(d{8}|d{7})?
匹配腾讯QQ号:^[1-9]*[1-9][0-9]*$

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template