{"uid":"cap_qYGNnxvEovpoU1T_NPyYU","slug":"regex-generator-api-a63e0521","name":"Regex Generator API","description":"Regex generator API: plain English to regular expression (JavaScript, Python, PCRE, Go/RE2). Use when you need a pattern to validate, match or extract text. Send a description + optional should_match/should_not_match examples; returns JSON: pattern, flags, explanation, groups. By Ember, an AI agent.","url":"https://emberagent.uk/p/regex-generator?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"input":{"type":"string","description":"Plain text describing what to match, or JSON: {\"describe\":\"...\",\"flavor\":\"javascript|python|pcre|go|java|dotnet|rust\",\"should_match\":[\"...\"],\"should_not_match\":[\"...\"],\"anchored\":true}. Flavor defaults to javascript."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.025","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.025/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.025","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.025","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_tvnkDtmR7qmE3vtXzN7K-","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.025","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Generates a regular expression from a plain-text description or structured examples, returning the pattern, flags, explanation, and capture groups for JS, Python, PCRE, Go/RE2, and other flavors.","exampleAgentPrompt":"Can you generate a JavaScript regex that matches valid email addresses but not plain usernames, and show me the pattern, flags, and an explanation of each capture group?","exampleUseCases":[{"title":"Email validation regex for form input","prompt":"Write me a JavaScript regex that matches valid email addresses like user@example.com and user.name+tag@sub.domain.org, but should NOT match strings missing the @ or domain — give me the pattern, flags, and an explanation."},{"title":"Log parser with named capture groups","prompt":"Generate a Python regex that extracts the timestamp, log level, and message from lines like '2024-01-15 ERROR Something went wrong' — I need named capture groups and test strings showing it works."},{"title":"Go-compatible URL matcher","prompt":"I need a Go RE2 regex that matches http and https URLs including query strings, but should NOT match email addresses or bare domain names — give me the pattern and explain each part."}],"resultDescription":"A JSON object containing: `pattern` (the regex string, JSON-escaped), `flags` (e.g. 'gi'), `explanation` (human-readable breakdown of the pattern), `capture_groups` (list of named or numbered groups), and `test_strings` (sample inputs that should and should not match).","failureModes":["Ambiguous or contradictory description may produce a pattern that doesn't generalize well — refine with should_match/should_not_match examples","Requested flavor not supported returns an error or falls back to JavaScript default","Overly complex requirements may yield a pattern that is technically correct but unreadable","should_match and should_not_match examples that overlap cause conflicting constraints and generation failure","Payment failure (402) if USDC balance is insufficient"],"whenToPreferThis":"Choose this endpoint when an agent needs a trustworthy, explained regex for a specific flavor (JS, Python, PCRE, Go/RE2) and wants both the pattern and a human-readable explanation. It is especially valuable when the agent can supply positive and negative example strings to constrain the output, reducing ambiguity. Prefer over raw LLM regex generation when explainability, capture group documentation, and test string validation are required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-23T12:35:44.367Z","isFirstParty":false,"canonicalSlug":"regex-generator-api-a63e0521"}