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"); 7?> 8--FILE-- 9<?php 10 mb_regex_encoding("UTF-8"); 11 mb_ereg_search_init(' 中国?'); 12 mb_ereg_search('(?<wsp>\s*)(?<word>\w+)(?<punct>[?!])'); 13 var_dump(mb_ereg_search_getregs()); 14?> 15--EXPECT-- 16array(7) { 17 [0]=> 18 string(11) " 中国?" 19 [1]=> 20 string(2) " " 21 [2]=> 22 string(6) "中国" 23 [3]=> 24 string(3) "?" 25 ["wsp"]=> 26 string(2) " " 27 ["word"]=> 28 string(6) "中国" 29 ["punct"]=> 30 string(3) "?" 31} 32