Skip to content

Commit 9496db6

Browse files
authored
Merge pull request #1344 from pjkaufman/master
Fix Custom Regex Replace for `\\\\` and `\b`
2 parents 7875997 + c680383 commit 9496db6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/strings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ export function hashString53Bit(str: string, seed: number = 0): number {
365365
* @return {string} The string with the escape characters converted to their escape character form.
366366
*/
367367
export function convertStringVersionOfEscapeCharactersToEscapeCharacters(val: string): string {
368-
// replace string version of backspace character with the actual backspace character
369-
val = val.replaceAll('\\b', '\b');
370368
// replace string version of form feed character with the actual form feed character
371369
val = val.replaceAll('\\f', '\f');
372370
// replace string version of new line character with the actual new line character
@@ -377,6 +375,8 @@ export function convertStringVersionOfEscapeCharactersToEscapeCharacters(val: st
377375
val = val.replaceAll('\\t', '\t');
378376
// replace string version of vertical tab character with the actual vertical tab character
379377
val = val.replaceAll('\\v', '\v');
378+
// replace string version of escaped \ with the single instance of \
379+
val = val.replaceAll('\\\\', '\\');
380380

381381
return val;
382382
}

0 commit comments

Comments
 (0)