Regex Explainer
Explain a regular expression in plain English, piece by piece, and optionally test it against sample strings.
regex-explain Example
{
"regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
} {
"breakdown": [
{
"token": "^",
"explanation": "Anchors the match to the start of the string"
},
{
"token": "[a-zA-Z0-9._%+-]+",
"explanation": "Matches one or more characters that are letters (upper/lowercase), digits, or the special characters . _ % + -"
},
{
"token": "@",
"explanation": "Matches the literal @ symbol"
},
{
"token": "[a-zA-Z0-9.-]+",
"explanation": "Matches one or more letters, digits, dots, or hyphens for the domain name"
},
{
"token": "\\.",
"explanation": "Matches a literal dot (escaped with backslash)"
},
{
"token": "[a-zA-Z]{2,}",
"explanation": "Matches 2 or more letters only for the top-level domain (TLD)"
},
{
"token": "$",
"explanation": "Anchors the match to the end of the string"
}
],
"plain_english": "This regex matches standard email addresses with a local part containing alphanumeric characters and special symbols, followed by an @ symbol, a domain name, and a top-level domain of at least 2 letters.",
"capture_groups": 0,
"common_matches": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
],
"flags_detected": {
"g": false,
"i": false,
"m": false
},
"original_regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"common_non_matches": [
"[email protected]",
"user@domain",
"user [email protected]",
"@example.com",
"[email protected]",
"[email protected]"
]
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
regex | string | Yes | — |
test_strings | array | No | — |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
breakdown | array | Always (present in every successful answer) |
plain_english | string | Always (present in every successful answer) |
capture_groups | integer | Always (present in every successful answer) |
common_matches | array | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "regex-explain",
"inputs": {
"regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
},
"max_price_cents": 5
}' {
"tool": "strale_execute",
"arguments": {
"slug": "regex-explain",
"inputs": {
"regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
},
"max_price_cents": 5
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "regex-explain",
inputs: {
"regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
},
max_price_cents: 5,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="regex-explain",
inputs={
"regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
},
max_price_cents=5,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i 'https://api.strale.io/x402/v2/regex-explain?regex=%5E%5Ba-zA-Z0-9._%25%2B-%5D%2B%40%5Ba-zA-Z0-9.-%5D%2B%5C.%5Ba-zA-Z%5D%7B2%2C%7D%24' Limitations
Engine-specific features may be incompletely explained
Explains standard regex syntax — engine-specific features (PCRE2 lookbehinds, .NET named groups) may not be fully documented
What to do instead: Specify the target regex engine in the input for more accurate explanations of engine-specific syntax
Output size cap per call
Structured output is limited to about 1,500 output tokens per call; requests exceeding this limit are refused rather than returned truncated. The `test_strings` array has no input-count cap, but each string adds a test result that can exceed the output limit; an identical retry does not help.
What to do instead: Provide fewer test_strings per call
Related tools
- Agent Trace Analysis €0.20
- API Docs Generator €0.20
- API Mock Responses €0.05
- Changelog Generator €0.03
- Code Converter €0.05
- Commit Message Generator €0.05