mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-11-23 22:33:48 +00:00
Quote delimiter in target text when using regular expressions
bug: T354498 Change-Id: I0bafbaa4cfb55e2d65712a747a2622b159417dea
This commit is contained in:
parent
475ad71b4c
commit
e9a086c4ee
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue