|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81537 Error in regular expression using negation.
Submitted: 2021-10-18 08:32 UTC Modified: 2021-10-18 08:43 UTC
From: jansverre at uffe dot no Assigned:
Status: Verified Package: PCRE related
PHP Version: 8.0.11 OS: Ubuntu Linux 20.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-10-18 08:32 UTC] jansverre at uffe dot no
Regular expression that *should* match a text does not match it. In the code sample, the second preg_match will match the link in the string, but not the first, and the only difference is that the input string contains an extra 'a' letter.

Test script:
$regex = '/(^|[\n\s\>\\";]+)([^ \,"\t\n\r<>;]+\.[^ \,\"\t\n\r<]+)/iu';

$text = 'This is a normal text., VG';
preg_match_all($regex, $text, $matches);

$text = 'This is normal text., VG';
preg_match_all($regex, $text, $matches);

Expected result:
Both $matches should contain the link

Actual result:
Only the last $matches contains the link.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-18 08:43 UTC]
-Status: Open +Status: Verified
 [2021-10-18 08:43 UTC]
This is a PCRE JIT issue (<> vs.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 17:03:14 2021 UTC