Added support for regex modifiers

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6668 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-04-16 19:40:01 +00:00
parent 5fe0038a74
commit fc8611b003
2 changed files with 11 additions and 3 deletions

View file

@ -404,7 +404,7 @@ class Set extends Object {
$contexts = array($data);
}
$tokens = array_slice(preg_split('/(?<!=)\/(?!])/', $path), 1);
$tokens = array_slice(preg_split('/(?<!=)\/(?![a-z]*\])/', $path), 1);
do {
$token = array_shift($tokens);
$conditions = false;

View file

@ -426,8 +426,16 @@ class SetTest extends UnitTestCase {
$expected = array(1, 3);
$r = Set::extract('/User[name=/n/]/id', $tricky);
$this->assertEqual($r, $expected);
$this->assertEqual($r, $expected);
$expected = array(4);
$r = Set::extract('/User[name=/N/]/id', $tricky);
$this->assertEqual($r, $expected);
$expected = array(1, 3, 4);
$r = Set::extract('/User[name=/N/i]/id', $tricky);
$this->assertEqual($r, $expected);
$common = array(
array(
'Article' => array(