1--TEST-- 2Testing mb_ereg_search() named capture groups 3--SKIPIF-- 4<?php 5if (!extension_loaded('mbstring')) die('skip mbstring not enabled'); 6function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build"); 7version_compare(MB_ONIGURUMA_VERSION, '6.9.4', '<') or die("skip requires oniguruma < 6.9.4"); 8?> 9--FILE-- 10<?php 11 mb_regex_encoding("UTF-8"); 12 mb_ereg_search_init(' 中国?'); 13 mb_ereg_search('(?<wsp>\s*)(?<word>\w+)(?<punct>[?!])'); 14 var_dump(mb_ereg_search_getregs()); 15?> 16--EXPECT-- 17array(7) { 18 [0]=> 19 string(11) " 中国?" 20 [1]=> 21 string(2) " " 22 [2]=> 23 string(6) "中国" 24 [3]=> 25 string(3) "?" 26 ["punct"]=> 27 string(3) "?" 28 ["wsp"]=> 29 string(2) " " 30 ["word"]=> 31 string(6) "中国" 32} 33