Skip to content

Commit

Permalink
HCK-7477 (#127)
Browse files Browse the repository at this point in the history
* HCK-7477: Update regex

* HCK-7477: Fix tests

* HCK-7477: update regex

* Escape backslash
  • Loading branch information
Nightlngale authored Aug 1, 2024
1 parent d171c73 commit 6d69670
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion forward_engineering/utils/escapeString.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { FORMATS } = require('../helpers/constants');

const MUST_BE_ESCAPED =
/(\\r|\\n|\\b|\\f|\\t|'|"|\\[0-9]{3}|\0|\\x5C[0-3]?[0-7]{1,2}|\x5C[xX][0-9A-Fa-f]{2}|\x5C[uU][0-9A-Fa-f]{4})/g;
/(\\r|\\n|\\b|\\f|\\t|'|"|\\[0-9]{3}|\0|\\x5C[0-3]?[0-7]{1,2}|\x5C[xX][0-9A-Fa-f]{2}|\x5C[uU][0-9A-Fa-f]{4}|\\)/g;

const escapeString = (scriptFormat, value) =>
scriptFormat === FORMATS.SNOWSIGHT ? `'${value.replace(MUST_BE_ESCAPED, '\\$1')}'` : `$$${value}$$`;
Expand Down

0 comments on commit 6d69670

Please sign in to comment.