regexp-tree
regexp-tree copied to clipboard
Optimization breaks "match all" in multiline regexps
This regexp is optimized like this:
- /lorem(?:.|\n)*?ipsum/m
+ /lorem[.\n]*?ipsum/m
This breaks the regex:
-
(.|\n)
means "any character, including a newline character" -
[.\n]
means "a period character or a newline character"
See https://github.com/sindresorhus/eslint-plugin-unicorn/issues/895.
Thanks, I'll take a look. Also will appreciate a PR if you reach it earlier.