|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10516 Recursive patterns don't work
Submitted: 2001-04-26 17:05 UTC Modified: 2001-04-26 17:14 UTC
From: martijn at ideeweb dot nl Assigned:
Status: Closed Package: PCRE related
PHP Version: 4.0.4pl1 OS: Win2K & Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
50 - 43 = ?
Subscribe to this entry?

 [2001-04-26 17:05 UTC] martijn at ideeweb dot nl
$s = "a(b(c)d)e(f)g";
$p = "/\( ( ( (?>[^()]+) | (?R) )* ) \)/xU";
if (preg_match_all($p, $s, $x)) {
   echo "match";
   // see what's in $x
} else {
   echo "no match";

This example pattern is taken straigh out of the PCRE docs, but I don't get the desired result, whatever I try. I haven't been able to succesfully use the experimental (?R) so I was wondering if anyone ever has.

In perl, recursive patterns seem to work fine by the way.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-26 17:14 UTC]
The results you get are consistent with (?R) description in PCRE docs. If you have a problem with that, contact the PCRE library author, please.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 13 17:01:24 2021 UTC