note 58559 deleted from reference.pcre.pattern.syntax by crell
| From: | crell@php.net | Date: | Fri, 01 Jul 2022 20:09:03 +0000 |
| Subject: | note 58559 deleted from reference.pcre.pattern.syntax by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218882@lists.php.net to get a copy of this message | ||
Note Submitter: roland dot illig at gmx dot de
----
<quote>
9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern /^(a)?(?(1)a|b)+$/
matches the string "a", whereas in PCRE it does not. However, in both Perl and PCRE
/^(a)?a/ matched against "a" leaves $1 unset.
</quote>
The last sentence does not indicate a bug. If the string "a" should match against the
regular expression /^(a)?a/, the last "a" in the regex must be matched by any literal
"a" in the string. The rest of the string is "", which obviously does not match
the first /^(a)/.