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