Regex Generator
Describe what to match in plain English and get a tested regular expression, checked against your examples if you give them.
regex-generate Example
{
"description": "This is a test input for automated capability testing."
} {
"flags": "g",
"regex": "This is a test input for automated capability testing\\.",
"explanation": "Matches the literal string 'This is a test input for automated capability testing.' - 'This is a test input for automated capability testing' matches the exact phrase, and '\\.' matches the literal period at the end. The 'g' flag finds all occurrences.",
"test_results": [
{
"input": "This is a test input for automated capability testing.",
"match": "This is a test input for automated capability testing.",
"matches": true
},
{
"input": "This is a test input for automated capability testing",
"match": null,
"matches": false
},
{
"input": "this is a test input for automated capability testing.",
"match": null,
"matches": false
},
{
"input": "This is a test input for automated capability testing. This is a test input for automated capability testing.",
"match": "This is a test input for automated capability testing.",
"matches": true
}
]
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
description | string | Yes | What to match in natural language |
test_strings | array | No | Optional strings to test against |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
flags | string | Always (present in every successful answer) |
regex | string | Always (present in every successful answer) |
explanation | string | Always (present in every successful answer) |
test_results | 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-generate",
"inputs": {
"description": "This is a test input for automated capability testing."
},
"max_price_cents": 5
}' {
"tool": "strale_execute",
"arguments": {
"slug": "regex-generate",
"inputs": {
"description": "This is a test input for automated capability testing."
},
"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-generate",
inputs: {
"description": "This is a test input for automated capability testing."
},
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-generate",
inputs={
"description": "This is a test input for automated capability testing.",
},
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-generate?description=This+is+a+test+input+for+automated+capability+testing.' Limitations
Complex patterns need testing and refinement
AI-generated regex — complex patterns with edge cases may need refinement and testing against your full dataset
What to do instead: Test the generated regex against both matching and non-matching examples before deploying in production
Output size cap per call
Structured output is limited to about 800 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
- Cron Explainer €0.02