php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49062 example wrong for PCRE backreference
Submitted: 2009-07-26 08:33 UTC Modified: 2009-07-26 10:17 UTC
From: alan at hcibook dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Mac OSX
Private report: No CVE-ID: None
 [2009-07-26 08:33 UTC] alan at hcibook dot com
Description:
------------
The last of the example strings below should be
  "ababba"

The string "ababaa" does not match as the pattern for the previous (2nd) iteration is "ba", hence to match b\1 on the third iteration, the rest of the string needs to be "bba"

other matching strings

  "abaaba"

  "abaaababba"

  "ababbabbba"



Reproduce code:
---------------
---
From manual page: regexp.reference.back-references
---

For example, the pattern (a|b\1)+  matches any number of "a"s and also "aba", "ababaa" etc.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-26 10:17 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 04:00:01 2026 UTC