php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43485 preg_replace not matching
Submitted: 2007-12-03 14:24 UTC Modified: 2007-12-03 15:50 UTC
From: cvlug at xs4all dot nl Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.5 OS: windows xp
Private report: No CVE-ID: None
 [2007-12-03 14:24 UTC] cvlug at xs4all dot nl
Description:
------------
preg_replace not matching, where it should match n(same for preg_match)

Reproduce code:
---------------
$regex='/(.*)<[^>]*submenu[^>]*>/mis';
$str is on url: http://www.koopjespakker.nl/test/preg_match_data/str_for_php.txt

$modified_string = preg_replace( $regex, 'sss', $str);


Expected result:
----------------
a replaced string (other then the input string, $str)

Actual result:
--------------
"" (preg_replace return nothing)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-03 15:50 UTC] felipe@php.net
The backtrack limit was exhausted.
Using preg_last_error(), it'll show 2. (PREG_BACKTRACK_LIMIT_ERROR)

See http://br.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 20:01:31 2024 UTC