{"uid":"cap_wQBc-Hh3FZukz3To3WNjl","slug":"javascript-regex-tester-76124a58","name":"JavaScript Regex Tester","description":"Run a JS regex on text: matches, groups, indexes. Capped input and a time budget stops catastrophic backtracking.","url":"https://dev-utils.x402tookit.com/regex-test?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"],"type":"string"},"queryParams":{"type":"object","required":["pattern","text"],"properties":{"text":{"type":"string","description":"Text to search, up to 20000 chars"},"flags":{"type":"string","description":"Any of gimsuyd, default g (without g only the first match is returned)"},"pattern":{"type":"string","description":"JavaScript regex source without slashes, up to 500 chars"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"source":{"type":["null","string"]},"tookMs":{"type":["null","number"]},"matches":{"type":["array","null"],"items":{"type":"object","properties":{"end":{"type":["null","number"]},"index":{"type":["null","number"]},"match":{"type":["null","string"]},"named":{"type":["null","object"],"properties":{"year":{"type":["null","string"]}}},"groups":{"type":["array","null"],"items":{"type":"string"}}}}},"reasons":{"type":["array","null"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"budgetMs":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"timedOut":{"type":["boolean","null"]},"flagsUsed":{"type":["null","string"]},"truncated":{"type":["boolean","null"]},"disclaimer":{"type":["null","string"]},"matchCount":{"type":["null","number"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_B9OcFyC6WSVnSUGsTXmJq","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs a JavaScript regex pattern against text and returns all matches, capture groups, and character indexes, with catastrophic-backtracking protection.","exampleAgentPrompt":"Run the regex pattern `(\\d{4})-(\\d{2})-(\\d{2})` with the global flag on this text: 'Meeting on 2024-03-15 and follow-up on 2024-04-02, deadline 2025-01-01' — give me all matches, groups, and their positions.","exampleUseCases":[{"title":"Extract dates from log file","prompt":"I have a big log string and I want to pull out every date in YYYY-MM-DD format. Use the pattern `(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})` with the global flag on this text: 'Error on 2024-01-10, resolved 2024-01-11, reopened 2024-03-22.'"},{"title":"Validate email pattern matching","prompt":"Test whether the regex `[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}` with the global flag finds all email addresses in this text: 'Contact us at support@example.com or sales@company.org for help.'"},{"title":"Parse structured data from messy text","prompt":"Run the regex `(\\w+):\\s*(\\d+)` globally on this text: 'apples: 4, oranges: 12, bananas: 7' and give me all the matched key-value pairs with their capture groups."}],"resultDescription":"Returns a list of match objects each containing the matched string, start index, end index, positional capture groups, and named capture groups. Also returns match count, flags used, execution time in ms, and boolean flags for timeout, truncation, and degraded mode if input was too large or the regex ran too long.","failureModes":["Regex times out due to catastrophic backtracking — timedOut flag is set to true and partial results may be returned","Input text exceeds 20000 characters — text is truncated and truncated flag is set","Regex pattern exceeds 500 characters — request rejected","Invalid regex syntax — error response returned","Invalid flags provided — request rejected or flags ignored"],"whenToPreferThis":"Use this endpoint when you need server-side JavaScript regex execution with safety guarantees against catastrophic backtracking, especially when the regex or input text is user-supplied and could cause a ReDoS attack in a local environment. Prefer this over running regex locally when you need a sandboxed, time-budgeted execution environment or when you need detailed match metadata including indexes and named groups.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-04T06:22:58.291Z","isFirstParty":false,"canonicalSlug":"javascript-regex-tester-76124a58"}