1--TEST-- 2Testing mb_ereg_search() function 3--EXTENSIONS-- 4mbstring 5--SKIPIF-- 6<?php 7function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build"); 8?> 9--FILE-- 10<?php 11 $str = "中国abc + abc ?!?!字符# china string"; 12 13 $reg = "\w+"; 14 15 mb_regex_encoding("UTF-8"); 16 17 mb_ereg_search_init($str, $reg); 18 $r = mb_ereg_search(); 19 20 if(!$r) 21 { 22 echo "null\n"; 23 } 24 else 25 { 26 $r = mb_ereg_search_getregs(); //get first result 27 do 28 { 29 var_dump($r[0]); 30 $r = mb_ereg_search_regs();//get next result 31 } 32 while($r); 33 } 34?> 35--EXPECT-- 36string(9) "中国abc" 37string(3) "abc" 38string(6) "字符" 39string(5) "china" 40string(6) "string" 41