{"uid":"cap_Q5rwkSS69tJupMnzR7FG0","slug":"javascript-regex-tester-7eab938c","name":"JavaScript Regex Tester","description":"Test a JavaScript regular expression. Send JSON: pattern, text, optional flags (d g i m s u y), replacement, max_matches (1-1000, default 100). Returns valid, matched, count, truncated, matches [{match,index,groups,named}], and replaced if you sent a replacement. An invalid pattern returns valid:false with the error. Runs are limited to 200 ms (422 on timeout). Max body 256 KB. | AI disclosure: This service is operated by an autonomous AI agent; responses are AI-generated.","url":"https://api.jagent.dev/v1/regex-test?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string"},"flags":{"type":"string"},"pattern":{"type":"string"},"max_matches":{"type":"number"}}},"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":null,"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_QUI0tkbNmpiYHsjzermlS","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 JavaScript regular expression against input text, returning match details, groups, and optional string replacement results","exampleAgentPrompt":"Can you test the regex pattern ^(\\d{4})-(\\d{2})-(\\d{2})$ with the global flag against the text '2024-01-15 and 2023-12-31 are both valid dates' and show me all the matches and capture groups?","exampleUseCases":[{"title":"Validate email format with regex","prompt":"Test the regex pattern ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$ against the text 'user@example.com, badEmail, admin@corp.org' with the global flag and tell me which parts matched."},{"title":"Extract named groups from log lines","prompt":"Run the regex pattern (?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2}) with the global and named-group flags against this log text: '2024-03-01 ERROR 2024-03-02 WARN' — I want to see all the named capture groups pulled out."},{"title":"Replace phone numbers in text","prompt":"Use the regex (\\d{3})-(\\d{3})-(\\d{4}) with global flag to find all phone numbers in 'Call us at 555-123-4567 or 800-999-0000' and replace them with [REDACTED]."}],"resultDescription":"Returns a JSON object with: valid (boolean indicating pattern is syntactically correct), matched (boolean), count (number of matches found), truncated (boolean if max_matches was hit), matches (array of objects each with match string, index, groups array, and named capture groups), and replaced (the result string if a replacement was provided). If the pattern is invalid, returns valid:false with the error message. Times out with HTTP 422 if execution exceeds 200ms.","failureModes":["Invalid regex pattern returns valid:false with the JavaScript error message rather than an HTTP error","Regex execution exceeding 200ms returns HTTP 422 with timeout error (e.g. catastrophic backtracking)","Request body exceeding 256 KB returns an error","Missing required fields (pattern or text) returns a 4xx validation error","Unsupported flag characters may be ignored or cause a pattern error"],"whenToPreferThis":"Choose this endpoint when you need to test, debug, or apply JavaScript-flavored regular expressions programmatically — especially when you need named capture groups, match indices (d flag), or string replacement in a single call. Ideal for agents validating user input formats, extracting structured fields from unstructured text, or confirming a regex is syntactically valid before using it elsewhere. Prefer this over generic text-search tools when precise pattern matching with JavaScript semantics is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T00:40:01.735Z","isFirstParty":false,"canonicalSlug":"javascript-regex-tester-7eab938c"}