Skip to content
New issue

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

"Invalid regular expression" when /s flag is used on long RegExps #3652

Open
dse opened this issue Apr 23, 2024 · 0 comments
Open

"Invalid regular expression" when /s flag is used on long RegExps #3652

dse opened this issue Apr 23, 2024 · 0 comments

Comments

@dse
Copy link

dse commented Apr 23, 2024

When sufficiently long regular expressions with the /s (dotAll) flag are used I always get an Invalid regular expression error. Reasonably minimal test case:

/*jshint esversion: 9 */
let rx;
rx = /a./s;
rx = /abcd.efgh/s;
rx = /abcd.efghiijklmnopq/s;
rx = /abcd.efghiijklmnopqr/s;
/* 7 */ rx = /abcd.efghiijklmnopqrs/s;
/* 8 */ rx = /abcd.efghiijklmnopqrst/s;
/* 9 */ rx = /abcd.efghiijklmnopqrstuv/s;
/* 10 */ rx = /abcd.efghiijklmnopqrstuvwxyz/s;

jshint output:

$ jshint ~/foo.js
/home/dembry/foo.js: line 7, col 14, Invalid regular expression.
/home/dembry/foo.js: line 8, col 14, Invalid regular expression.
/home/dembry/foo.js: line 9, col 14, Invalid regular expression.
/home/dembry/foo.js: line 10, col 15, Invalid regular expression.

4 errors

jshint version:

$ jshint --version
jshint v2.13.6

node version

$ node --version
v18.19.0

I can't find anything in the documentation about /s even being a problem at all.

This issue goes at least as far back as jshint 2.10.

This also occurs on the web demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant