php-8.0.30-src/ext/mbstring/tests/mb_ereg_search_named_subpat...

33 lines
766 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--TEST--
Testing mb_ereg_search() named capture groups
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build");
version_compare(MB_ONIGURUMA_VERSION, '6.9.4', '<') or die("skip requires oniguruma < 6.9.4");
?>
--FILE--
<?php
mb_regex_encoding("UTF-8");
mb_ereg_search_init(' 中国?');
mb_ereg_search('(?<wsp>\s*)(?<word>\w+)(?<punct>[])');
var_dump(mb_ereg_search_getregs());
?>
--EXPECT--
array(7) {
[0]=>
string(11) " 中国?"
[1]=>
string(2) " "
[2]=>
string(6) "中国"
[3]=>
string(3) ""
["punct"]=>
string(3) ""
["wsp"]=>
string(2) " "
["word"]=>
string(6) "中国"
}