suggest_rewrites
Generate verified safe regex rewrites for ReDoS-prone patterns. Each candidate is tested for correctness, non-linear performance, and equivalence before returning the best.
Instructions
Mechanically generate safe-rewrite CANDIDATES for a ReDoS-prone pattern and
return only the ones that are VERIFIED. Use this when analyze/redos_bench
flags a pattern as super-linear and you want a concrete, drop-in replacement
rather than just the name of a technique.
Each candidate is independently checked: correctness on your positives/
negatives, non-super-linear growth on engine, AND language equivalence to
the original (exact DFA comparison when both are regular, else seeded
differential fuzzing). A candidate is marked safe/chosen as best ONLY if
all three hold -- never an unverified guess. best is null when nothing
verifies. Deterministic for a given seed. Note: atomic-group/possessive
candidates need a modern engine (Python re>=3.11, PCRE2, Java); RE2/Go can't
parse them, which the candidate notes call out.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| engine | No | python | |
| fuzz_n | No | ||
| pattern | Yes | ||
| negatives | No | ||
| positives | No | ||
| timeout_ms | No | ||
| equivalence_mode | No | auto |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||