php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martijn at ideeweb dot nl
New email:
PHP Version: OS:

 

 [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.


Regards,
Martijn

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-26 17:14 UTC] andrei@php.net
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-2025 The PHP Group
All rights reserved.
Last updated: Thu Mar 13 21:01:32 2025 UTC