Skip to content

Commit

Permalink
Fix regex to handle multiple escaped backslashes
Browse files Browse the repository at this point in the history
  • Loading branch information
j433866 committed May 9, 2019
1 parent f9354c8 commit cbcc2aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ class Utils {
args = m[2]
.replace(/"/g, '\\"') // Escape double quotes
.replace(/(^|,|{|:)'/g, '$1"') // Replace opening ' with "
.replace(/([^\\]|[^\\]\\\\)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with "
.replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g, '$1"$2') // Replace closing ' with "
.replace(/\\'/g, "'"); // Unescape single quotes
args = "[" + args + "]";

Expand Down

0 comments on commit cbcc2aa

Please sign in to comment.