We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
echo '/"/g' > main.js; npx nectar main.js
gives
SyntaxError: unknown: Unterminated string constant. (1:6) - make sure this is an expression. > 1 | ("/"/g")
This works if instead of /"/ we use /\x22/
/"/
/\x22/
cat > main.js <<EOF var x = '"text"'; console.log(x.replace(/\\x22/g, "\\"")) EOF npx nectar main.js; ./main.js
"text"
Notice that the expected output is \"text\", the same happens if we try to replace the e for something else.
\"text\"
e
The same is true for new RegExp("\x22", "g")
new RegExp("\x22", "g")
console.log(typeof /e/) // gives string console.log(typeof new RegExp('e')) // gives object
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
1. Escaping quotes in regular expressions.
gives
This works if instead of
/"/
we use/\x22/
2. Replacing inline regular expression does not work
gives
Notice that the expected output is
\"text\"
, the same happens if we try to replace thee
for something else.The same is true for
new RegExp("\x22", "g")
3 Literal regular expressions produce string
The text was updated successfully, but these errors were encountered: