Home > Backend Development > PHP Tutorial > 求大神帮忙写一个惟独数字,字母,中文,下划线,/,空格 组成的正则表达式。 急

求大神帮忙写一个惟独数字,字母,中文,下划线,/,空格 组成的正则表达式。 急

WBOY
Release: 2016-06-13 12:02:18
Original
948 people have browsed it

求大神帮忙写一个只有数字,字母,中文,下划线,/,空格 组成的正则表达式。!!!急 急 急
大腿们帮下俺这个菜鸟的忙!!谢谢
------解决方案--------------------

/^[\w \\]+$/u
Copy after login

非 utf-8 的需治安成 utf-8 后再使用
------解决方案--------------------
^[\u4e00-\u9fa5_a-zA-Z0-9\s\\]+$
------解决方案--------------------
<br />  $aa = ' 我/1a_';<br />  $ones =preg_match('/^[\w \/]+$/ui', $aa,$match); <br />  var_dump($match);<br />//输出:array(1) { [0]=> string(8) " 我/1a_" } <br />
Copy after login

------解决方案--------------------
'/[\x{4e00}-\x{9fa5}\W\w\\ ]/u'
Copy after login

utf8下

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