Merge "Quote delimiter in target text when using regular expressions"

This commit is contained in:
jenkins-bot 2024-01-08 15:55:20 +00:00 committed by Gerrit Code Review
commit 0480d83b71

View file

@ -914,7 +914,8 @@ class SpecialReplaceText extends SpecialPage {
// Get all indexes
if ( $use_regex ) {
preg_match_all( "/$target/Uu", $text, $matches, PREG_OFFSET_CAPTURE );
$targetq = str_replace( "/", "\\/", $target );
preg_match_all( "/$targetq/Uu", $text, $matches, PREG_OFFSET_CAPTURE );
} else {
$targetq = preg_quote( $target, '/' );
preg_match_all( "/$targetq/", $text, $matches, PREG_OFFSET_CAPTURE );