Home >Backend Development >PHP Tutorial >XH1Q8335军绿
怎么用正则将XH1Q8335军绿 分开 XH1Q8335 军绿 两部分
不需要用正则吧,用str_replace('军绿',' 军绿','XH1Q8335军绿');
或者:str_replace('XH1Q8335军绿','XH1Q8335 军绿',$str);
或者:str_replace('XH1Q8335军绿','XH1Q8335 军绿',$str);
我要是把汉字和其他字符分开. 你这是死方法
$s = 'XH1Q8335军绿';preg_match('/(\w+)(\W+)/', $s, $r);print_r($r);Array ( [0] => XH1Q8335军绿 [1] => XH1Q8335 [2] => 军绿 )