Merge pull request #3994 from microsoft/hediet/b/lonely-pelican

Fixes regexp
This commit is contained in:
Henning Dieterichs 2023-06-02 02:27:27 +02:00 committed by GitHub
commit 8bb1a4e863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,12 +247,12 @@ export class PlaygroundModel {
const regexp = new RegExp( const regexp = new RegExp(
"(\\b" + "(\\b" +
escapeRegexpChars(codeStringName) + escapeRegexpChars(codeStringName) +
":[^\\w`]*`)([^`\\\\\\n]|\\n|\\\\\\\\|\\\\|\\$`)*`" ":[^\\w`]*`)([^`\\\\\\n]|\\n|\\\\\\\\|\\\\\\`|\\\\\\$)*`"
); );
const js = this.js; const js = this.js;
const str = value const str = value
.replaceAll("\\", "\\\\") .replaceAll("\\", "\\\\")
.replaceAll("$", "\\$") .replaceAll("$", "\\$$$$")
.replaceAll("`", "\\`"); .replaceAll("`", "\\`");
const newJs = js.replace(regexp, "$1" + str + "`"); const newJs = js.replace(regexp, "$1" + str + "`");
const autoReload = this.settings.autoReload; const autoReload = this.settings.autoReload;