regex_extract
Apply a regular expression to text and return matches as JSON. Includes capture groups for extracting patterns like emails, URLs, or codes.
Instructions
Run a regular expression against text and return all matches. Supports capture groups, named groups, and multiline input. Returns a JSON array of match objects — each has match (full match) and groups (array of capture groups, or object for named groups). Use for extracting emails, URLs, codes, patterns, or any structured data from unstructured text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to search. | |
| pattern | Yes | Regular expression pattern (without delimiters). | |
| flags | No | Regex flags string (default "gi"). Common: g=global, i=case-insensitive, m=multiline, s=dotAll. | |
| maxMatches | No | Max matches to return (default 100, max 500). |