regexp-tree icon indicating copy to clipboard operation
regexp-tree copied to clipboard

Optimization breaks "match all" in multiline regexps

Open FloEdelmann opened this issue 4 years ago • 1 comments

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.

FloEdelmann avatar Jan 12 '21 11:01 FloEdelmann

Thanks, I'll take a look. Also will appreciate a PR if you reach it earlier.

DmitrySoshnikov avatar Jan 20 '21 05:01 DmitrySoshnikov