{"ecosystem":"npm","package":"escape-string-regexp","version":null,"bugs":[{"id":298,"ecosystem":"npm","package_name":"escape-string-regexp","affected_version":null,"fixed_version":null,"bug_id":"github:20","title":"Hyphens in Unicode mode","description":"With the current behavior of escaping `-`, there is a problem if used in a Unicode regex.\r\n\r\nYou can see that:\r\n\r\n```js\r\nconst esc = require('escape-string-regexp');\r\nnew RegExp(esc('-'), 'u');\r\n```\r\n\r\ngives:\r\n\r\n> Invalid regular expression: /\\-/: Invalid escape\r\n\r\nbecause this does also:\r\n\r\n```js\r\nnew RegExp('\\\\-', 'u');\r\n```\r\n\r\nWould seem to call for a Unicode mode? (The hyphen would still need escaping (and be safe to use) within a character class though.)\r\n\r\nI don't know whether you'd want to get into such parsing, but just sharing as it is something I came across.","severity":"medium","status":"fixed","source":"github_issues","source_url":"https://github.com/sindresorhus/escape-string-regexp/issues/20","labels":["bug","help wanted"],"created_at":"2026-04-19 04:31:00.247106+00:00","updated_at":"2026-04-19 04:31:00.247106+00:00"}],"total":1,"_cache":"hit"}