{"uid":"cap_b9mPPDyeatf5K7gsUZCdv","slug":"api-strale-io-c27fbf7e","name":"Regex Explainer with Token Breakdown","description":"Explain a regular expression in plain English with token-by-token breakdown. Optionally test against sample strings.","url":"https://api.strale.io/x402/regex-explain?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["regex"],"properties":{"regex":{"type":"string"},"test_strings":{"type":"array"}}}},"additionalProperties":false}}},"responseSchema":null,"example":{"request":{"regex":"^[a-z]+@[a-z]+\\.[a-z]{2,}$","test_strings":["user@example.com","invalid.email","test@domain.co.uk"]},"response":{"_meta":{"payment":{"method":"x402","price_usd":0.054000000000000006,"settlement_id":"0xf265a17ce9bff73dfde62babede230067e09d9b57ddf404dab4a7efe864bfd46"},"capability":"regex-explain","latency_ms":3719,"provenance":{"source":"claude-haiku","fetched_at":"2026-06-13T04:22:58.017Z"}},"breakdown":[{"token":"^","explanation":"Start of string anchor - ensures matching begins at the start"},{"token":"[a-z]+","explanation":"One or more lowercase letters (the email local part/username)"},{"token":"@","explanation":"Literal @ symbol required in the email"},{"token":"[a-z]+","explanation":"One or more lowercase letters (the domain name)"},{"token":"\\.","explanation":"Escaped literal dot/period character"},{"token":"[a-z]{2,}","explanation":"Two or more lowercase letters (the top-level domain like com, co, uk)"},{"token":"$","explanation":"End of string anchor - ensures matching ends at the end"}],"test_results":[{"input":"user@example.com","matches":true,"matched_text":"user@example.com"},{"input":"invalid.email","matches":false,"matched_text":null},{"input":"test@domain.co.uk","matches":false,"matched_text":null}],"plain_english":"Matches lowercase email addresses with a local part, domain name, and a top-level domain of at least 2 characters, with no special characters allowed.","capture_groups":0,"common_matches":["user@example.com","test@domain.co","hello@world.org","abc@def.info"],"flags_detected":{"g":false,"i":false,"m":false},"original_regex":"^[a-z]+@[a-z]+\\.[a-z]{2,}$","common_non_matches":["invalid.email","user@example","User@Example.Com","test@domain.c","test@123.com","test@domain.co.uk"]}},"exampleRequest":{"regex":"^[a-z]+@[a-z]+\\.[a-z]{2,}$","test_strings":["user@example.com","invalid.email","test@domain.co.uk"]},"tags":["x402"],"displayCostAmount":"0.054001","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.054001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.054","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.054","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ESiEnsUOIxLpwmenIPJe1","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.054","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Explains a regular expression in plain English with a token-by-token breakdown, and optionally tests it against sample strings.","exampleAgentPrompt":"Can you explain what this regex does, token by token: ^(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d]{8,}$ — and test it against these strings: 'Password1', 'hello', 'Abcdefg2'?","exampleUseCases":[{"title":"Data validation rule verification for compliance","prompt":"I need to validate email addresses in our customer database. Can you break down this regex pattern for me and test it against these sample emails: 'user@company.com', 'invalid.email@', and 'test+tag@domain.co.uk'?"},{"title":"Regex pattern debugging in production code","prompt":"We have this complex phone number pattern that's supposed to match US and international formats: ^\\+?1?\\d{9,15}$. Can you explain what each part does and whether it would match '+44 20 7946 0958' and '(555) 123-4567'?"},{"title":"Learning regex syntax before implementation","prompt":"I'm trying to understand this username validation regex before I add it to our signup form: ^[a-zA-Z0-9_-]{3,16}$. Can you walk me through what each token matches and test it with 'user_123', 'ab', and 'valid-name_42'?"}],"resultDescription":"A plain-English explanation of the regular expression with a detailed token-by-token breakdown describing what each part of the pattern matches, plus optional test results showing which sample strings match or fail the regex.","failureModes":["Missing required 'regex' query parameter returns an error","Malformed or invalid regex syntax may return a parse error","Empty regex string may return a validation error","test_strings array with unsupported types may be rejected"],"whenToPreferThis":"Use this endpoint when a user needs to understand what a regular expression does without reading raw syntax, or when debugging whether a regex matches specific strings. Ideal for developers learning regex, code reviewers, or AI agents that need to verify regex logic before applying it.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T18:44:28.149Z","isFirstParty":false,"canonicalSlug":"api-strale-io-c27fbf7e"}