Fix bug with strings that start with special chars
This commit is contained in:
parent
0444a8512e
commit
3526b390d5
|
@ -24,9 +24,12 @@ const replaceAll = () => {
|
|||
}
|
||||
|
||||
const escapeAndReplace = (input_word, replace_value, case_sensitive) => {
|
||||
const input_word_escaped = escapeRegExp(input_word.trim())
|
||||
let input_word_escaped = escapeRegExp(input_word.trim())
|
||||
const flags = case_sensitive ? "g" : "ig"
|
||||
const regexp_input_word = new RegExp(`\\b${input_word_escaped}\\b`, flags)
|
||||
if (!input_word_escaped.startsWith('\\')) {
|
||||
input_word_escaped = `\\b${input_word_escaped}\\b`
|
||||
}
|
||||
const regexp_input_word = new RegExp(input_word_escaped, flags)
|
||||
replace(regexp_input_word, replace_value)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "InteractiveFics",
|
||||
"author": "mariamrf",
|
||||
"version": "5.0",
|
||||
"version": "5.0.1",
|
||||
"description": "Replaces Y/N & other variables in Reader Insert/second person fics with words of your choice.",
|
||||
"browser_action": {
|
||||
"default_title": "InteractiveFics",
|
||||
|
|
Loading…
Reference in New Issue