首頁 >後端開發 >php教程 >preg_match("^[-u4e00-u9fa5w]+$","哈哈11122") 报错

preg_match("^[-u4e00-u9fa5w]+$","哈哈11122") 报错

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-06 20:28:441320瀏覽

<code>preg_match("^[-\u4e00-\u9fa5\w]+$","哈哈11122")  报错

preg_match(): No ending delimiter '^' found</code>

回复内容:

<code>preg_match("^[-\u4e00-\u9fa5\w]+$","哈哈11122")  报错

preg_match(): No ending delimiter '^' found</code>

<code class="php">preg_match("/^([\x{4e00}-\x{9fa5}]+)\w+$/u","哈哈11122",$match) ;
var_dump($match);
array(2) {
  [0]=>
  string(11) "哈哈11122"
  [1]=>
  string(6) "哈哈"
}</code>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn