> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# regex-catastrophic-backtracking

> A regular expression that can backtrack exponentially or in polynomial time runs on request input.

## What it flags

A fixed regular expression with nested or overlapping repetition (such as `(a+)+` or `(a|aa)+`), or overlapping repeats in sequence (such as `\s+.*\s+$`), runs on request input and can backtrack exponentially or in polynomial time, blocking the event loop. Rewrite it so each part matches text one way. Cutting the input to a fixed length first, such as `slice(0, 254)`, clears only the polynomial cases.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "regex-catastrophic-backtracking": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.