Php regular match string ending with Chinese characters This post was last edited by zhuzhaodan in 2013-06-0900: 04: 00 UTF-8 format $ str & nbsp; 289dfh first match & nbsp; & nbsp; jdfh388 second match & nbsp; jfsj83 third match & nbsp; sjf php regular match string ending with Chinese characters
This post was last edited by zhuzhaodan at 00:04:00 on
UTF-8 format
$ Str = "289dfh first matched jdfh388 second matched jfsj83 third matched sjfsui"
1) 289dfh first match
2) jdfh388 second match
3) jfsj83 third match
Share:
------ Solution --------------------
This post was last edited by xuzuning at 07:05:36 on
$ Str = "289dfh first matched jdfh388 second matched jfsj83 third matched sjfsui ";
Preg_match_all ('/\ w + [\ x {4e00}-\ x {9fa5}]/iu', $ str, $ r );
Print_r ($ r [0]);
Array
(
[0] => 289dfh first match
[1] => jdfh388 second match
[2] => jfsj83 third match
)
------ Solution --------------------
$ Str = "289dfh: The first matches jdfh388, the second matches jfsj83, and the third matches sjfsui. do not use haha ";
Preg_match_all ('/\ s *(?! [\ X {4e00}-\ x {9fa5}]) \ w + [\ x {4e00}-\ x {9fa5}] +/iu ', $ str, $ r );
Print_r ($ r [0]);
You mean this?
You can simply use the negative order ring ~~~