regex_test
Test a regular expression pattern against an input string and return all matches with their index positions and named capture groups. Use for validating user inputs, extracting structured data from text, or debugging regex patterns. Supports flags g, i, m, s, u, y. The match runs in an isolated thread with a 500 ms budget: a pattern that blows up (catastrophic backtracking, e.g. "(a+)+$") comes back as redos_detected:true — a real ReDoS verdict on your pattern — instead of hanging.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | No | Regex flags: g (global), i (case-insensitive), m (multiline), s (dotAll) — default: "" | |
| input | Yes | The string to test against (max 50 KB) | |
| pattern | Yes | Regular expression pattern (without delimiters) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| flags | No | ||
| matched | No | ||
| matches | No | ||
| pattern | No | ||
| verdict | No | ||
| elapsed_ms | No | ||
| match_count | No | ||
| redos_detected | No |