I have a regex that uses lookbehind:
(?<!\S)\'\S(.*?)\S\'(?!\S)
It's an ES2018 feature.
I'm also using Typescript, so I run my code with ts-node.
When running the code, I got this error:
SyntaxError: Invalid regular expression: /(?<!\S)\'\S(.*?)\S\'(?!\S)/:
Invalid group
Doing this, however, runs the code successfully:
node --harmony script.js
I tried adding this to my tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"lib": [
"ES2018" // I also tried es2018. No luck.
],
"module": "commonjs",
"outDir": "out",
"sourceMap": true
}
}
But I'm getting the same error.
Any advice?
Note: I updated node to version 13 via nvm. Doing node script.js works, but not ts-node script.ts. I already have the latest version of ts-node, so I'm not sure what to do.