Maison > Article > développement back-end > 继续求教正则表达式有关问题
继续求教正则表达式问题
<br /> $str = "昨天 @测试 hiaaaa dd@测试 反反复复";<br /> $reg = "/([^@]+(?=\s))/";<br /> $arr = preg_split($reg,$str,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );<br /> print_r($arr);<br />
Array ( [0] => 昨天 [1] => @ [2] => 测试 [3] => hiaaaa [4] => dd@ [5] => 测试 [6] => 反反复复 )
Array ( [0] => 昨天 @ [1] => 测试 [2] => hiaaaa dd@ [3] => 测试 [4] => 反反复复 )
$str = "昨天 @测试 hiaaaa dd@测试 反反复复@好友2";