safe-regex icon indicating copy to clipboard operation
safe-regex copied to clipboard

Detect possibly catastrophic, exponential-time regular expressions

Results 11 safe-regex issues
Sort by recently updated
recently updated
newest added

feel free to contribute and keep it improving!

This PR adds built-in TS type definitions taken from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/safe-regex (aka npmjs.com/package/@types/safe-regex) Note for the future and for maintainability: these types only need to be changed if: - A new...

```js /\p{L}/u.test('Θ') // true ``` get transformed into ```js /p{L}/u.test('Θ') // false ``` which produces wrong output. (originally reported at https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1754)

Hi @davisjam Example: `/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])\.)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){2}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/i` is optimized by regexp-tree to `/^(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|[1-9])\.(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){2}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/i` The first is considered a safe regex by safe-regex, the second one not. Is this a valid finding? I just...

**Context:** Heuristic#1: `Star height > 1`, dictates there should be **no repetition inside of repetition**. **Issue:** The regex in question is `/abcd(-[0-9a-z]{10,20}){2}/`, which has repetition inside of repetition but it...

IE11 throws an error on the `class` keyword. Any chance you can offer a version of this library that's transpiled to IE11 supported code?

Hacktoberfest

See examples in this [substack/safe-regex issue](https://github.com/substack/safe-regex/issues/12).