PHP regular filter Chinese

WBOY
Release: 2016-07-28 08:28:26
Original
2157 people have browsed it

//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.

Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!