{"uid":"cap_VurphBMsdn5JWX6gkjnQj","slug":"x402-deployer-x402-deployer-workers-dev-82b86098","name":"Regex Generator from Natural Language Prompt","description":"Regex generator / NL to regex / pattern builder. PCRE / JavaScript / Python / Go / RE2. Returns pattern + flags + explanation + 3-6 test examples. Live-runs JS regex on sample_text.","url":"https://x402-deployer.x402-deployer.workers.dev/regex-from-prompt","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"required":["prompt"],"properties":{"flags":{"type":"string","description":"Optional. Regex flags for testing sample_text, e.g. 'gi'. Only applied with the javascript flavor."},"flavor":{"enum":["pcre","javascript","python","go","re2"],"type":"string","description":"Optional. Regex flavor: pcre, javascript (default), python, go, or re2."},"prompt":{"type":"string","description":"Plain-English description of the pattern to build. Max 2,000 chars."},"sample_text":{"type":"string","description":"Optional. Text to test the generated pattern against. Max 20,000 chars. Live-run only for the javascript flavor."}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"flags":{"type":"string"},"pattern":{"type":"string"}}}}}}},"responseSchema":null,"example":{"request":{"input":{"body":{"flags":"g","flavor":"javascript","prompt":"Match all valid email addresses","sample_text":"Contact support@example.com or info@test.org for assistance"},"type":"http","method":"POST","bodyType":"json"}},"response":{"flags":"g","model":"mistral-small-3-2-24b-instruct","flavor":"javascript","source":"venice","caveats":["This regex does not cover all possible valid email addresses according to the official specification (RFC 5322).","It does not handle internationalized email addresses (those with non-ASCII characters).","The regex does not handle quoted local parts (e.g., \"user name\"@example.com)."],"pattern":"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$","live_error":null,"explanation":"This regex matches strings that start with one or more alphanumeric characters, dots, underscores, percent signs, plus signs, or hyphens, followed by an @ symbol, then one or more alphanumeric characters, dots, or hyphens, a dot, and finally two or more letters.","live_matches":[],"test_examples":[{"input":"user@example.com","reason":"Valid email address","should_match":true},{"input":"firstname.lastname@example.co.uk","reason":"Valid email address with multiple subdomains","should_match":true},{"input":"user@sub.domain.com","reason":"Valid email address with subdomain","should_match":true},{"input":"user@.com","reason":"Invalid email address, missing domain","should_match":false},{"input":"user@domain","reason":"Invalid email address, missing top-level domain","should_match":false},{"input":"user@domain..com","reason":"Invalid email address, consecutive dots","should_match":false}],"sample_text_chars":59}},"exampleRequest":{"flags":"g","flavor":"javascript","prompt":"Match all valid email addresses","sample_text":"Contact support@example.com or info@test.org for assistance"},"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Fa-XiSGG7E6RizWDv9Eq1","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts a natural language description into a regex pattern with flags, explanation, and test examples, with live JS execution on sample text","exampleAgentPrompt":"Generate a JavaScript regex that matches a valid US phone number in formats like (555) 123-4567 or 555-123-4567, and test it against the sample text: 'Call us at (800) 555-1234 or 1-800-555-9876 for support.'","exampleUseCases":null,"resultDescription":"Returns a regex pattern string, associated flags, a plain-English explanation of how the pattern works, 3-6 test example strings (showing matches/non-matches), and live JS regex execution results against the provided sample text.","failureModes":["Ambiguous prompt leads to incorrect or overly broad pattern","Requested flavor not supported returns error","Sample text not provided skips live execution results","Payment not included or insufficient USDC returns 402","Very complex multi-condition patterns may produce incomplete regex"],"whenToPreferThis":"Use this endpoint when you need to generate a regex from a plain English description and want an immediate explanation plus test cases — especially useful when targeting a specific flavor (PCRE, JS, Python, Go, RE2) or when you want to validate the pattern against sample text in one call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:57:02.216Z","isFirstParty":false}