Home >Backend Development >PHP Tutorial >php正则表达式的问题?

php正则表达式的问题?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:31:311123browse

<code>$name=$_POST['name'];
$nr="/^[a-zx{4e00}-x{9fa5}]+$/iu";
preg_match($nr,$name,$match)
</code>

出现一下错误:
preg_match(): Delimiter must not be alphanumeric or backslash

我看到stackoverflow上说没有分隔符,我想应该不是这个原因,不知道是什么问题?

回复内容:

<code>$name=$_POST['name'];
$nr="/^[a-zx{4e00}-x{9fa5}]+$/iu";
preg_match($nr,$name,$match)
</code>

出现一下错误:
preg_match(): Delimiter must not be alphanumeric or backslash

我看到stackoverflow上说没有分隔符,我想应该不是这个原因,不知道是什么问题?

你是要匹配中文吗?

$nr="/^[a-z\x{4e00}-\x{9fa5}]+$/iu";

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