{"uid":"cap_PdGvdXJGTBmqkyudSJbZB","slug":"writerslogic-ecmascript-regex-safety-checker-6268e7dd","name":"WritersLogic ECMAScript Regex Safety Checker","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/regex-check?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"cases":{"type":"array","items":{"type":"object","required":["subject"],"properties":{"subject":{"type":"string","maxLength":1000},"expectMatch":{"type":"boolean"}},"additionalProperties":false},"maxItems":20,"description":"Subjects to test; at most 10000 characters in total."},"flags":{"type":"string","pattern":"^[dgimsuvy]*$","maxLength":8,"description":"Flags among dgimsuy (v is reported unsupported)."},"pattern":{"type":"string","maxLength":500,"description":"ECMAScript regex source, without slashes."}}},"responseSchema":{"type":"json"},"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_silKiuXp59QajGGujhJgp","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":"Statically analyzes an ECMAScript regular expression for catastrophic backtracking risk and optionally runs test subjects against it when proven safe","exampleAgentPrompt":"Can you check this regex for catastrophic backtracking: `(a+)+b` with the flags `gi`, and test it against the string 'aaaaaaaaac' to see if it matches?","exampleUseCases":[{"title":"ReDoS vulnerability audit before deploy","prompt":"Before I ship this input validation regex `^([a-zA-Z0-9]+\\s?)+$` to production, check whether it's vulnerable to catastrophic backtracking — if it's safe, test it against 'hello world' and 'hello   world   ' to confirm it matches correctly."},{"title":"LLM-generated regex safety review","prompt":"My AI assistant just wrote the regex `(\\w+\\s*){2,}` with the `m` flag to parse user comments — can you do a static analysis for exponential backtracking risk and, if it passes, run it against 'foo bar baz' expecting a match and 'xyz' expecting no match?"},{"title":"User-submitted pattern acceptance gate","prompt":"A user submitted the pattern `(x|xx)*y` for our search feature — analyze it for ReDoS risk before we run it; if it's proven safe, test it against the string 'xxy' expecting a match and 'zzz' expecting no match."}],"resultDescription":"Returns a verdict for the regex: 'pass' (polynomially bounded, safe to run), 'fail' (provably exponential with the specific split named), or 'unknown' (neither proven safe nor unsafe). If safe and test subjects are provided and within length bounds, returns match results for each subject. Reports unsupported features (e.g. the 'v' flag) and any structural risks like nested quantifiers, backreferences, or lookarounds.","failureModes":["Pattern exceeds 500 characters — rejected without analysis","More than 20 test subjects supplied — request rejected","Test subjects exceed 1000 characters each or 10000 total — rejected","Pattern is 'unknown' safety status — test subjects not run, only risk report returned","Pattern is 'fail' — exponential split reported, no test subjects run","Unsupported regex flavor or 'v' flag used — reported as unsupported","Invalid flags characters outside allowed set — validation error"],"whenToPreferThis":"Use this endpoint when an AI agent writes, accepts, or forwards user-supplied ECMAScript regular expressions and needs to guard against ReDoS (Regular Expression Denial of Service) before execution. Prefer it over running regexes directly when patterns come from untrusted sources or LLM generation, since static analysis avoids timeouts entirely. It is specifically scoped to ECMAScript regex semantics — do not use it for PCRE, Python re, or other flavors.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:40:47.028Z","isFirstParty":false,"canonicalSlug":"writerslogic-ecmascript-regex-safety-checker-6268e7dd"}