{"uid":"cap_w4Djgluj0iHckgiBPxmTm","slug":"ai-regex-generator-and-tester-3d8bb4a5","name":"AI Regex Generator and Tester","description":"Generate a regex from a description and TEST it against your examples — Genesis402 / UnyKorn Operator Network","url":"https://twin.unykorn.org/ai/regex?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"params":{"type":"object","properties":{"flavor":{"type":"string","description":"optional: javascript (default) | python | pcre"},"description":{"type":"string","description":"required, up to 500 chars"},"should_match":{"type":"array","items":{"type":"string"},"maxItems":10,"description":"optional up to 10 examples"},"should_not_match":{"type":"array","items":{"type":"string"},"maxItems":10,"description":"optional up to 10 examples"}}}}},"responseSchema":{"type":"json","example":{"ok":true,"type":"regex-generate","receipt":{"tx_hash":"0x<64hex>","amount_usd":0.005,"receipt_id":"g402-<16hex>"},"sources":[{"ok":true,"name":"<source>"}],"limitations":"<text>","generated_at":"<iso time>","evidence_hash":"sha256:<64hex>"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","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.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_EoM_zg8Z8gjUsPwAmmwAZ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","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-language description and validates it against user-supplied match/no-match examples","exampleAgentPrompt":"Generate a JavaScript regex that matches valid email addresses, and test it — the pattern should match 'user@example.com' and 'hello+tag@sub.domain.org', but not 'notanemail' or 'missing@'","exampleUseCases":[{"title":"Validate user input format","prompt":"Create a regex that matches US phone numbers in formats like '(555) 123-4567' and '555-123-4567', but not strings like 'call me' or '12345'. Use JavaScript flavor and test it against those examples."},{"title":"Extract log timestamps","prompt":"Generate a Python regex that matches ISO 8601 timestamps like '2024-01-15T08:30:00Z' and '2024-12-31T23:59:59+05:30', but should not match plain dates like '2024-01-15' without a time component."},{"title":"Validate password policy","prompt":"Build a regex that enforces our password policy — it should match 'Secure@123' and 'P@ssw0rd!' but not 'password' or '12345678'. I need it in PCRE flavor for our backend."}],"resultDescription":"Returns a generated regular expression matching the given description, plus test results showing which provided examples matched and which did not, allowing immediate verification of the pattern's correctness.","failureModes":["Description too vague or contradictory — may produce a regex that doesn't correctly reflect intent","Conflicting match/no-match examples — endpoint may fail or return a best-effort pattern","Description exceeds 500 character limit — request rejected","More than 10 examples in should_match or should_not_match — request rejected","Unsupported flavor value — falls back to JavaScript default","Network or payment failure — returns 402 or connection error"],"whenToPreferThis":"Choose this endpoint when you need to both generate and immediately validate a regular expression in one step, especially when you have concrete positive and negative examples to test against. It is ideal for agents automating code generation, data validation pipelines, or form input validation where correctness must be confirmed before use. Prefer this over a plain LLM regex request when test-driven verification of the output matters.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T18:34:55.158Z","isFirstParty":false,"canonicalSlug":"ai-regex-generator-and-tester-3d8bb4a5"}