1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Files
archived-php-src/ext/mbstring/tests/mb_ereg.phpt
T
Moriyoshi Koizumi b62afe783d %s/SKIP/skip/g
2002-11-15 15:34:57 +00:00

48 lines
1.6 KiB
PHP
Raw 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--
mb_ereg()
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip mbstring not available');
function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
?>
--INI--
output_handler=
--FILE--
<?php
mb_regex_set_options( '' );
$encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) {
mb_regex_encoding( $test_enc );
$pat = mb_convert_encoding( $pat, $test_enc, $in_enc );
$str = mb_convert_encoding( $str, $test_enc, $in_enc );
printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc ) : '' ) );
}
function do_tests( $enc ) {
test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" );
$pat = '([-]+) ([ あ-か]+)([か-な]+) ([わ-ん]+)$';
test_ereg( $enc, $pat, 'abc あおい かこな わゑん' );
test_ereg( $enc, $pat, 'mzxfp うおか きか をゐ' );
}
foreach( $encs as $enc ) {
do_tests( $enc );
}
?>
--EXPECT--
(15)abc def ghi jkl def ghi jkl
(27)abc あおい かこな わゑん abc あおい か こな わゑん
(27)mzxfp うおか きか をゐ mzxfp うおか きか をゐ
(15)abc def ghi jkl def ghi jkl
(27)abc あおい かこな わゑん abc あおい か こな わゑん
(27)mzxfp うおか きか をゐ mzxfp うおか きか をゐ
(15)abc def ghi jkl def ghi jkl
(27)abc あおい かこな わゑん abc あおい か こな わゑん
(27)mzxfp うおか きか をゐ mzxfp うおか きか をゐ
(15)abc def ghi jkl def ghi jkl
(39)abc あおい かこな わゑん abc あおい か こな わゑん
(39)mzxfp うおか きか をゐ mzxfp うおか きか をゐ