Home >Backend Development >PHP Tutorial >请问一个正则匹配中英文混合的有关问题utf-8

请问一个正则匹配中英文混合的有关问题utf-8

WBOY
WBOYOriginal
2016-06-13 10:25:071027browse

请教一个正则匹配中英文混合的问题utf-8
假设
$str = " asdasdasdasqqsa";
if (preg_match("/[\x{4e00}-\x{9fa5}]+/u",$str,$str1)) {
echo $str1[0];

这样是输出“编程”
那么请问下大家,如果想让他输出“
这个正则要怎么写呢?


------解决方案--------------------
preg_match("//u",$str,$str1)
------解决方案--------------------
preg_match("/]*>/",$str,$str1) 这样呢?

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