{"uid":"cap_GOxHz93-VOwrbM1lFRD5t","slug":"402utils-regex-test-redos-guard-81e05bd2","name":"402utils Regex Test & ReDoS Guard","description":"Test a regex against one or many inputs, safely. Send {pattern, flags?, input|inputs[], mode?}: 'match' returns the first match + capture groups, 'matchAll' every match, 'replace' the rewritten string (needs {replacement}). A mandatory ReDoS guard statically rejects catastrophic patterns (nested quantifiers, `.*.*$`, backrefs) BEFORE running — on Workers no timeout can stop a runaway regex. For agents that generate and dry-run regexes.","url":"https://402utils.com/v1/regex-test?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"mode":{"enum":["match","matchAll","replace"],"type":"string","default":"match","description":"match | matchAll | replace."},"flags":{"type":"string","description":"Any of gimsuyd (g added automatically for matchAll)."},"input":{"type":"string","description":"A single input string (≤ 10000 chars)."},"inputs":{"type":"array","items":{"type":"string"},"maxItems":50,"description":"Multiple input strings."},"pattern":{"type":"string","description":"The regular expression source (no delimiters)."},"replacement":{"type":"string","description":"Replacement string (with $1, $<name>) — required for mode 'replace'."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.1000","medianCents":"0.1000","p90Cents":"0.1000","minCents":"0.1000","maxCents":"0.1000","p95Cents":"0.1000","sampleCount":1,"varies":false,"failureChargeRate":1},"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_E3a0DnF7KM6sCmUxdNEF5","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Tests a regex pattern against one or more input strings using match, matchAll, or replace modes, with a mandatory static ReDoS safety check that rejects catastrophic patterns before execution.","exampleAgentPrompt":"Test my regex pattern `^(\\d{3})-?(\\d{3})-?(\\d{4})$` with the flag `i` in matchAll mode against these three strings: '555-867-5309', 'not-a-phone', and '8005551234' — and make sure it's safe to run first.","exampleUseCases":null,"resultDescription":"Returns the match result according to the chosen mode: for 'match', the first match and any named or indexed capture groups; for 'matchAll', every match found across the input; for 'replace', the fully rewritten string with substitutions applied. If the pattern is detected as catastrophically backtracking (e.g. nested quantifiers, `.*.*$`, or backreferences), the request is rejected with a ReDoS safety error before any execution occurs.","failureModes":["Pattern flagged as ReDoS-unsafe — rejected before execution with a descriptive safety error","Pattern syntax error — invalid regex returns a parse error","Input string exceeds 10,000 character limit — returns a validation error","inputs array exceeds 50 items — returns a validation error","mode set to 'replace' without providing a replacement string — returns a missing-field error","Unsupported flags passed — returns a validation error"],"whenToPreferThis":"Choose this endpoint when an AI agent is generating or dry-running regex patterns and needs a safe execution environment — particularly when the patterns are untrusted or LLM-generated and could be catastrophically backtracking. Also ideal when you need to test a single pattern against up to 50 strings in one call, or when you need replace mode with capture group substitutions. Prefer this over running regex locally when ReDoS safety guarantees are required on a serverless/Workers runtime where timeouts cannot stop runaway patterns.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T06:46:20.273Z","isFirstParty":false,"canonicalSlug":"402utils-regex-test-redos-guard-81e05bd2"}