Bug #79670 [NEW]: Regex with non-greedy dot-all does not match "$" correctly

From: Date: Wed, 03 Jun 2020 11:51:06 +0000
Subject: Bug #79670 [NEW]: Regex with non-greedy dot-all does not match "$" correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227290@lists.php.net to get a copy of this message
From: not-implemented at mark-plomer dot de Operating system: any PHP version: 7.3.18 Package: PCRE related Bug Type: Bug Bug description:Regex with non-greedy dot-all does not match "$" correctly Description: ------------ The following regex with non-greedy dot-all selector does not consume the last newline from input. Note that the PCRE-Modifier "m" is NOT used, so "$" should match the end-of-string only. Test script: --------------- $x = preg_replace('/A.*?$/s', 'X', "A\n"); echo json_encode($x); Expected result: ---------------- "X" Actual result: -------------- "X\n" -- Edit bug report at https://bugs.php.net/bug.php?id=79670&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79670&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79670&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79670&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79670&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79670&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79670&r=support Expected behavior: https://bugs.php.net/fix.php?id=79670&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79670&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79670&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79670&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79670&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79670&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79670&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79670&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79670&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79670&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79670&r=mysqlcfg

« previous php.bugs (#227290) next »