Home  >  Article  >  php教程  >  Warning: preg_match(): Compilation failed:

Warning: preg_match(): Compilation failed:

WBOY
WBOYOriginal
2016-06-08 17:25:541748browse
<script>ec(2);</script>

warning: preg_match(): compilation failed: pcre does not support l, l, n, p, p, u, u, or x at offset 3 in f:wwwrootwww.111cn.nettest.php教程 on line 2

解决方法

preg_match("/^[x80-xff_a-za-z0-9]{3,15}",strname);

下面我们来看一款php正则中文实例

是用x表示十六进制数据的。于是,变换成如下的代码:

$str = "php编程";
if (preg_match("/^[x4e00-x9fa5]+$/",$str)) {
print("该字符串全部是中文");
} else {
print("该字符串不全部是中文");
}


提供一款js正则中文

var str = "www.111cn.net编程";
if (/^[u4e00-u9fa5]+$/.test(str)) {
alert("该字符串全部是中文");
}
else{
alert("该字符串不全部是中文");
}

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