{"uid":"cap_aNnSGi770bTSi8fUMNFSW","slug":"x402-tools-regex-from-examples-3901c8c0","name":"x402-tools Regex From Examples","description":"Pay-per-call utility APIs for AI agents, settled in USDC via the x402 protocol.","url":"https://x402.nichospt.net/regex-from-examples?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"flavor":{"enum":["js","pcre","python"],"type":"string","default":"js"},"examples":{"type":"array","items":{"type":"string"},"maxItems":50,"minItems":1,"description":"Strings the regex MUST match"},"should_not_match":{"type":"array","items":{"type":"string"},"maxItems":50,"description":"Strings the regex MUST NOT match (optional)"}}},"responseSchema":{"type":"json","example":{"flags":"","pattern":"^[\\w.+-]+@[\\w-]+(?:\\.[\\w-]+)+$","validation":{"failures":[],"matchesAll":true,"rejectsAll":true},"explanation":"Matches simple email addresses."}},"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":{"p10Cents":"0.5000","medianCents":"0.5000","p90Cents":"0.5000","minCents":"0.5000","maxCents":"0.5000","p95Cents":"0.5000","sampleCount":1,"varies":false,"failureChargeRate":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_Cxp81k3Lq1sHub1DCL2ws","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Generates a regular expression that matches given example strings and optionally rejects specified strings, supporting JS, PCRE, and Python flavors.","exampleAgentPrompt":"Generate a JavaScript regex from these examples that must match: 'user@example.com', 'hello+tag@mail.co.uk', 'name.last@sub.domain.org' — and must NOT match: 'notanemail', '@nodomain.com', 'missing@'.","exampleUseCases":null,"resultDescription":"Returns a JSON object containing the inferred regex pattern string, any flags needed, a human-readable explanation of what the pattern matches, and a validation report showing whether all positive examples matched and all negative examples were rejected, plus any failures.","failureModes":["No valid regex can satisfy both positive and negative examples simultaneously — returns error or partial match","Too few examples provided to infer a meaningful pattern — may return overly broad or literal regex","Contradictory examples (a string in both match and should_not_match) — validation failures reported","Unsupported regex flavor requested — returns 400 or defaults","Payment not settled via x402 — 402 Payment Required response blocks the call"],"whenToPreferThis":"Use this endpoint when you need to programmatically infer a regex from concrete string examples rather than writing one by hand, especially when the pattern logic is non-obvious or you want automatic validation. Ideal for agents building dynamic input validators, data pipelines, or form field matchers at runtime. Choose the flavor parameter to match your runtime (js for browsers/Node, python for Python scripts, pcre for PHP/Nginx/grep).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T12:34:33.282Z","isFirstParty":false,"canonicalSlug":"x402-tools-regex-from-examples-3901c8c0"}