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

php正则表达式的问题?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:31:31
Original
1125 people have browsed it

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

出现一下错误:
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>
Copy after login
Copy after login

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

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

你是要匹配中文吗?

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

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template