ID: 49568 Updated by: j...@php.net Reported By: anoop dot john at zyxware dot com -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Ubuntu Jaunty PHP Version: 5.2.10 New Comment:
Well, it isn't a bug. Your pattern just doesn't work properly. Try adding '?' in the end of it.. See also: http://php.net/manual/en/regexp.reference.meta.php Previous Comments: ------------------------------------------------------------------------ [2009-09-18 18:13:36] anoop dot john at zyxware dot com Oh no I don't have a big issue with the bug as far as my application's needs are concerned. The example was only a use case I tried while testing the regex. I reported the bug (if it is indeed one) so that you can fix it (if it is worth fixing) for everybody's sake :-) ------------------------------------------------------------------------ [2009-09-18 17:55:52] j...@php.net How about fixing your pattern to match 1 or more times? Now it only matches if there's exactly one match. ------------------------------------------------------------------------ [2009-09-18 14:25:52] anoop dot john at zyxware dot com I tried taking out conditions from the regular expressions but when I took out the first condition the expression starts giving the expected result. So the symptom appears only for the specific expression and the specific text. My logic about the issue seems to be OK. If pattern \(P\) matches (A) returns (A) as matches array \(P\) does not match (B) where no part of P can match \( or \) then \(P\) should definitely match (B)(A) and return (A) in the matches array ------------------------------------------------------------------------ [2009-09-18 13:46:51] j...@php.net Please, simplify the regex to as much as possible. Once you have the simplest case still showing the problem we might be able to say whether it's a bug or not. ------------------------------------------------------------------------ [2009-09-16 18:16:59] anoop dot john at zyxware dot com I know for sure one thing. The pattern matches only one opening brace and one closing brace. So it cannot start matching with the first pair of brackets and go on matching the second pair of braces in the example given. When it fails with the first pair of braces the matching should restart beginning with the opening brace of the second pair of braces. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/49568 -- Edit this bug report at http://bugs.php.net/?id=49568&edit=1