Home  >  Article  >  Backend Development  >  PHP regular filter Chinese

PHP regular filter Chinese

WBOY
WBOYOriginal
2016-07-28 08:28:262094browse

//if(!preg_match_all("/[".chr(0xa1)."-".chr(0xff)."]+/",$str,$match)) //GB2312 Chinese character alphanumeric underline regular expression Formula "/[".chr(0xa1)."-".chr(0xff)."]+/"Chinese gb2312 regular

if(!preg_match_all("/^[x{4e00}-x{9fa5} A-Za-z0-9_]+$/u",$str,$match)) //UTF-8 Chinese character alphanumeric underline regular expression "/[x{4e00}-x{9fa5}]+/u" Chinese regular rules for utf8 pages

The above has introduced PHP regular filtering in Chinese, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Previous article:Tomcat安全配置Next article:windows系统 nginx域名配置