Linear-Time O(n) ReDoS-Safe Regular Expression Synthesizer & Tester
synthesize_safe_regexSynthesizes linear-time O(n) regular expressions free of catastrophic backtracking (ReDoS) and validates them against positive and negative test strings. Use when generating and verifying a regular expression pattern for input validation or lexical parsing; for repairing broken JSON syntax directly without writing custom regexes, use heal_malformed_json instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'description' ('flavor' defaults to 'ecmascript_js'), supports '?demo=true' or L402 (15 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flavor | No | Target regular expression engine syntax; defaults to 'ecmascript_js' when omitted. | |
| description | Yes | Natural-language specification of the text pattern to match (e.g. 'RFC 5322 email addresses excluding plus-aliases'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Synthesized regular expression pattern string (without slash delimiters). | |
| redos_safe | Yes | True when static star-height analysis confirms zero exponential backtracking. | |
| test_results | Yes | Pass/fail verification results across positive and negative test cases. | |
| time_complexity | Yes | Worst-case matching complexity ('O(n)'). |