1--TEST-- 2Testing mb_ereg() duplicate named groups 3--EXTENSIONS-- 4mbstring 5--SKIPIF-- 6<?php 7function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build"); 8?> 9--FILE-- 10<?php 11 mb_regex_encoding("UTF-8"); 12 $pattern = '\w+((?<punct>?)|(?<punct>!))'; 13 mb_ereg($pattern, '中?', $m); 14 var_dump($m); 15 mb_ereg($pattern, '中!', $m); 16 var_dump($m); 17?> 18--EXPECT-- 19array(4) { 20 [0]=> 21 string(6) "中?" 22 [1]=> 23 string(3) "?" 24 [2]=> 25 bool(false) 26 ["punct"]=> 27 string(3) "?" 28} 29array(4) { 30 [0]=> 31 string(6) "中!" 32 [1]=> 33 bool(false) 34 [2]=> 35 string(3) "!" 36 ["punct"]=> 37 string(3) "!" 38} 39