Closed
Description
With the current behavior of escaping -
, there is a problem if used in a Unicode regex.
You can see that:
const esc = require('escape-string-regexp');
new RegExp(esc('-'), 'u');
gives:
Invalid regular expression: /-/: Invalid escape
because this does also:
new RegExp('\\-', 'u');
Would seem to call for a Unicode mode? (The hyphen would still need escaping (and be safe to use) within a character class though.)
I don't know whether you'd want to get into such parsing, but just sharing as it is something I came across.