1--TEST--
2mb_ereg_replace() with named subpatterns
3--EXTENSIONS--
4mbstring
5--SKIPIF--
6<?php
7function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
8?>
9--FILE--
10<?php
11    mb_regex_set_options('');
12    // \k<word> syntax
13    echo mb_ereg_replace('(?<a>\s*)(?<b>\w+)(?<c>\s*)', '\k<a>_\k<b>_\k<c>', 'a b c d e' ), "\n";
14    // \k'word' syntax
15    echo mb_ereg_replace('(?<word>[a-z]+)',"<\k'word'>", 'abc def ghi'), PHP_EOL;
16    // numbered captures with \k<n> syntax
17    echo mb_ereg_replace('(1)(2)(3)(4)(5)(6)(7)(8)(9)(a)(\10)', '\k<0>-\k<10>-', '123456789aa'), PHP_EOL;
18    // numbered captures with \k'n' syntax
19    echo mb_ereg_replace('(1)(2)(3)(4)(5)(6)(7)(8)(9)(a)(\10)', "\k'0'-\k'10'-", '123456789aa'), PHP_EOL;
20    // backref 0 works, but 01 is ignored
21    echo mb_ereg_replace('a', "\k'0'_\k<01>", 'a'), PHP_EOL;
22    // Numbered backref is ignored if named backrefs are present
23    echo mb_ereg_replace('(?<a>A)\k<a>', '-\1-', 'AA'), PHP_EOL;
24    // An empty backref is ignored
25    echo mb_ereg_replace('(\w)\1', '-\k<>-', 'AA'), PHP_EOL;
26    // An unclosed backref is ignored
27    echo mb_ereg_replace('(?<a>\w+)', '-\k<a', 'AA'), PHP_EOL;
28?>
29--EXPECT--
30_a_ _b_ _c_ _d_ _e_
31<abc> <def> <ghi>
32123456789aa-a-
33123456789aa-a-
34a_\k<01>
35-\1-
36-\k<>-
37-\k<a
38