1--TEST--
2Testing mb_ereg() named subpatterns
3--SKIPIF--
4<?php
5if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
6function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
7?>
8--FILE--
9<?php
10    mb_regex_encoding("UTF-8");
11    mb_ereg('(?<wsp>\s*)(?<word>\w+)', '  中国', $m);
12    var_dump($m);
13    mb_ereg('(?<wsp>\s*)(?<word>\w+)', '国', $m);
14    var_dump($m);
15    mb_ereg('(\s*)(?<word>\w+)', '  中国', $m);
16    var_dump($m);
17?>
18--EXPECT--
19array(5) {
20  [0]=>
21  string(8) "  中国"
22  [1]=>
23  string(2) "  "
24  [2]=>
25  string(6) "中国"
26  ["wsp"]=>
27  string(2) "  "
28  ["word"]=>
29  string(6) "中国"
30}
31array(5) {
32  [0]=>
33  string(3) "国"
34  [1]=>
35  bool(false)
36  [2]=>
37  string(3) "国"
38  ["wsp"]=>
39  bool(false)
40  ["word"]=>
41  string(3) "国"
42}
43array(3) {
44  [0]=>
45  string(8) "  中国"
46  [1]=>
47  string(6) "中国"
48  ["word"]=>
49  string(6) "中国"
50}
51