php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53751 pcre pattern modifier U doesn't mention backtrack limit
Submitted: 2011-01-14 18:22 UTC Modified: 2011-02-10 14:03 UTC
From: php at richardneill dot org Assigned: vrana (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2011-01-14 18:22 UTC] php at richardneill dot org
Description:
------------
The documentation for pcre patterns
   http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
has a section on Ungreediness ("U").

This ought to contain some mention of pcre.backtrack_limit

(it would have saved me many hours if it had!)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-15 23:08 UTC] frozenfire@php.net
Could you please provide more information as to what you think should be added? If there's something that one will likely run into when using the ungreedy modifier, which would benefit others to know, it will certainly be added. :)
 [2011-01-15 23:21 UTC] php at richardneill dot org
Something like:

Ungreedy matching is normally limited to strings of < 100k characters; this is configured by [link]pcre.backtrack_limit[/link] 

A similar warning should also go in the section on regexp repetition here:
http://uk3.php.net/manual/en/regexp.reference.repetition.php


I think it's worth putting this warning in both places, because perl-hackers will tend to use REs like ".*?", whereas people arriving from other languages are more likely to discover greed/laziness by reading about the pattern-modifiers. Also, if one does exceed this limit, PHP doesn't complain about it: not even an E_NOTICE!

Incidentally, I have no performance problem with raising this value from 100k to 100M, and I can still match a 90M character string in under 3 seconds on a netbook.
 [2011-02-10 14:03 UTC] vrana@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: vrana
 [2011-02-10 14:03 UTC] vrana@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.


 [2011-02-10 14:03 UTC] vrana@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=308190
Log: Mention pcre.backtrack_limit by ungreedy modifier (doc bug #53751)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 23:00:01 2026 UTC