Permalink
Browse files

[Finder] '*' and '?' are considered are glob pattern rather than deli…

…miters (fix #4664)
  • Loading branch information...
vicb committed Jul 2, 2012
1 parent 05c884e commit 4d6a965beae234bd0fa7f61681bd8a54df60f042
Showing with 5 additions and 1 deletion.
  1. +2 −0 CHANGELOG.md
  2. +1 −1 Iterator/MultiplePcreFilterIterator.php
  3. +2 −0 Tests/Iterator/MultiplePcreFilterIteratorTest.php
View
@@ -12,3 +12,5 @@ CHANGELOG
* added searching based on the file content via Finder::contains() and
Finder::notContains()
* added support for the != operator in the Comparator
+ * [BC BREAK] filter expressions (used for file name and content) are no more
+ considered as regexps but glob patterns when they are enclosed in '*' or '?'
@@ -58,7 +58,7 @@ protected function isRegex($str)
$end = substr($m[1], -1);
if ($start === $end) {
- return !preg_match('/[[:alnum:] \\\\]/', $start);
+ return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}
if ($start === '{' && $end === '}') {
@@ -38,6 +38,8 @@ public function getIsRegexFixtures()
array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
array('#foo#', true, '"#" is a valid delimiter'),
array('{foo}', true, '"{,}" is a valid delimiter pair'),
+ array('*foo.*', false, '"*" is not considered as a valid delimiter'),
+ array('?foo.?', false, '"?" is not considered as a valid delimiter'),
);
}
}

0 comments on commit 4d6a965

Please sign in to comment.