File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
regexiterator_getregex.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:43 2012 UTC (12 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
SPL: RegexIterator::getRegex() basic tests
--CREDITS--
Joshua Thijssen <jthijssen@noxlogic.nl>
--FILE--
<?php
$array = array('cat', 'hat', 'sat');
$iterator = new ArrayIterator($array);
# Simple regex
$regexIterator = new RegexIterator($iterator, '/.at/');
var_dump($regexIterator->getRegex());
# Empty regular expression
$regexIterator = new RegexIterator($iterator, '//');
var_dump($regexIterator->getRegex());
# "Complex" email regular expression
$regexIterator = new RegexIterator($iterator, '|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|');
var_dump($regexIterator->getRegex());
?>
--EXPECT--
string(5) "/.at/"
string(2) "//"
string(43) "|\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>