Closed domdomegg closed 1 year ago
In JavaScript, the following regex is valid:
/(?=a)?/
However, it is rejected by regjsparser (SyntaxError: Expected atom at position 5).
SyntaxError: Expected atom at position 5
I think an optional forward lookahead is a little pointless, but it seems to be used. For example, this appears in the wild in ua-parser-js: https://github.com/faisalman/ua-parser-js/blob/3c3c03ceeba9920437533dcf1d72276acac091a3/src/ua-parser.js#L464
ua-parser-js
Thank you for reporting this issue. I will take a look over the weekend.
Created CR #131.
Fixed and release 0.10.0 published to npm.
In JavaScript, the following regex is valid:
However, it is rejected by regjsparser (
SyntaxError: Expected atom at position 5
).I think an optional forward lookahead is a little pointless, but it seems to be used. For example, this appears in the wild in
ua-parser-js
: https://github.com/faisalman/ua-parser-js/blob/3c3c03ceeba9920437533dcf1d72276acac091a3/src/ua-parser.js#L464