Home >Backend Development >PHP Tutorial >List of regular expressions commonly used in form validation_PHP tutorial

List of regular expressions commonly used in form validation_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:40:56929browse

Regular expression to match Chinese characters: [u4e00-u9fa5]
Match double-byte characters (including Chinese characters): [^x00-xff]
Regular expression to match blank lines: [s| ]*
Regular expression matching HTML tags: /<(.*)>.*|<(.*) />/
Matching leading and trailing spaces Regular expression: (^s*)|(s*$)
Regular expression matching email addresses: w ([- .]w )*@w ([-.]w )*.w ([- .]w )*
Regular expression matching URL: ^[a-zA-z] ://(w (-w )*)(.(w (-w )*))*(?S *)?$
Is the matching account legal (starting with a letter, 5-16 bytes allowed, alphanumeric underscores allowed): ^[a-zA-Z][a-zA-Z0-9_]{4,15} $
Match domestic phone numbers: (d{3}-|d{4}-)?(d{8}|d{7})?
Match Tencent QQ numbers: ^[1-9]* [1-9][0-9]*$

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486171.htmlTechArticleRegular expression matching Chinese characters: [u4e00-u9fa5] Matches double-byte characters (including Chinese characters) :[^x00-xff] Regular expression matching blank lines: [s| ]* Regular expression matching HTML tags...
Statement:
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