From d0392467fc7c6cdd1e2e50f60f4b3fa72274a95b Mon Sep 17 00:00:00 2001 From: Claim Yang Date: Sat, 31 Oct 2020 21:20:15 +0800 Subject: [PATCH] Fix bug when escaping '\\' The original version only replace ONE '\\', if the string has more than one '\\', the code won't escape them. Add 'g' flag to the escQuoteRegex. --- lib/Lexer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Lexer.js b/lib/Lexer.js index bbed63e2..0f3e2fcf 100644 --- a/lib/Lexer.js +++ b/lib/Lexer.js @@ -5,7 +5,7 @@ const numericRegex = /^-?(?:(?:[0-9]*\.[0-9]+)|[0-9]+)$/ const identRegex = /^[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$][a-zA-Zа-яА-Я0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$]*$/ -const escEscRegex = /\\\\/ +const escEscRegex = /\\\\/g const whitespaceRegex = /^\s*$/ const preOpRegexElems = [ // Strings