Regex tester: run a regular expression, get matches + groups
util_regexRun a JavaScript regular expression against text and get every match with its position, numbered and named capture groups, plus an optional replace result. Use to extract emails/IDs/prices from text, or to check a regex before putting it in code. Accepts /pattern/flags or pattern + flags (g i m s u y d v). Up to 100k characters of text and 1000 matches returned. Sandboxed with a 250 ms limit: catastrophic-backtracking patterns return 400 (not charged) instead of hanging. Price: $0.001 per call (USDC on Base via x402); the first 10 calls per day are free.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>",
"text": "<text>"
},
"name": "util_regex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to search (max 100,000 chars) | |
| flags | No | Flags, e.g. gi (optional; default from /…/flags or none) | |
| pattern | Yes | Regex, e.g. (?<user>[\w.]+)@(?<domain>[\w.-]+\.\w+) or /abc/i | |
| replace | No | Optional replacement string ($1, $<name> allowed) | |
| max_matches | No | Max matches to return, 1–1000 (default 100) |