Closed Awen-hub closed 3 years ago
this is working as expected. to support lookbehind assertions, you need to set ecmaVersion >= 2018
refs: https://github.com/tc39/proposals/blob/master/finished-proposals.md
this is working as expected. to support lookbehind assertions, you need to set ecmaVersion >= 2018
refs: https://github.com/tc39/proposals/blob/master/finished-proposals.md
Thanks very much. I have solved the problem when setting { ecmaVersion: 2020 }
.
` const espree = require("espree");
console.log(espree.parse("const reg = /(?<=A).*?(?=B)/g", { ecmaVersion: 6 }))`
When I run the code with nodeJS, it throws an error "SyntaxError: Invalid regular expression: /(?<=A).?(?=B)/: Invalid group". However the regular expression "/(?<=A).?(?=B)/g" can be used in Chrome so I think it it not an invalid regular expression.