Fixed global matching for simple strings in 'Find / Replace' operation. Closes #25.

This commit is contained in:
n1474335 2017-06-15 14:21:30 +00:00
parent 3faef2c9c9
commit 04aac03d6e
3 changed files with 24 additions and 6 deletions

View file

@ -227,14 +227,16 @@ const StrUtils = {
if (type === "Regex") {
find = new RegExp(find, modifiers);
} else if (type.indexOf("Extended") === 0) {
return input.replace(find, replace);
}
if (type.indexOf("Extended") === 0) {
find = Utils.parseEscapedChars(find);
}
return input.replace(find, replace, modifiers);
// Non-standard addition of flags in the third argument. This will work in Firefox but
// probably nowhere else. The purpose is to allow global matching when the `find` parameter
// is just a string.
find = new RegExp(Utils.escapeRegex(find), modifiers);
return input.replace(find, replace);
},