|  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
 [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: Wed Sep 22 09:03:38 2021 UTC