Commit b966e295 authored by Imran Hussain's avatar Imran Hussain

When putting a regex in a string literal you need one more round of escaping

parent 71ae841c
......@@ -103,7 +103,7 @@ function replace(targetWord, newWord, text) {
// checks for word boundry (\b) or line end ($) at the end
// to stop parts of words being picked up when they shouldn't
// "gi" just says match every (g) and ignore case (i)
newSubTexts.push(element.replace(new RegExp("(^|\b)"+targetWord+"($|\b)","gi"),newWord));
newSubTexts.push(element.replace(new RegExp("(^|\\b)"+targetWord+"($|\\b)","gi"),newWord));
if (debugmode >= 2) {
mw.print("DEBUG: text after replace: " + newSubTexts);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment