{"uid":"cap_lOzNvUuXonlSu3_ImWdaY","slug":"regex-match-re2-regex-openverbs-com-c9ac981c","name":"Regex Match (RE2) – regex.openverbs.com","description":"Find the first match (or all matches with all=true) of a RE2 pattern, returning each match's text, start/end offsets, and numbered and named capture groups. No match is a successful 200 with an empty match list.","url":"https://regex.openverbs.com/v1/match","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["pattern","input"],"properties":{"all":{"type":"boolean","description":"Return every match instead of just the first. Default false."},"flags":{"type":"string","maxLength":8,"description":"Any of i (case-insensitive), m (multiline ^$), s (dotall). Default none."},"input":{"type":"string","maxLength":1000000,"description":"The subject text."},"pattern":{"type":"string","maxLength":4096,"minLength":1,"description":"RE2 regular-expression pattern."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_NoAsLtPXWtmSlVoQWcwIb","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Finds the first (or all) matches of a RE2 regular expression in a text string, returning each match's text, start/end offsets, and numbered and named capture groups.","exampleAgentPrompt":"Scan this server log line with the RE2 pattern `(?P<ip>\\d{1,3}(?:\\.\\d{1,3}){3}) (?P<method>GET|POST|PUT|DELETE)` and give me all matches with their named capture groups — return every match, not just the first.","exampleUseCases":[{"title":"Extract emails from newsletter text","prompt":"Use the pattern `[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,}` to find every email address in this blob of text and return all of them with their positions: \"Contact us at hello@example.com or support@company.org for help.\""},{"title":"Parse structured log entries with named groups","prompt":"Run the RE2 pattern `(?P<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}) (?P<level>INFO|WARN|ERROR) (?P<message>.+)` against this log line and give me the named captures: \"2024-05-01T14:32:11 ERROR disk quota exceeded on /var/log\""},{"title":"Extract version number from release string","prompt":"Find the first match of the pattern `v(\\d+)\\.(\\d+)\\.(\\d+)` in the string \"Released v3.12.4 with hotfix\" and tell me the full match text plus the three numbered capture groups."}],"resultDescription":"A JSON object containing a list of match objects. Each match includes the matched text, its start and end character offsets in the input, an array of numbered capture groups, and a map of named capture groups. If no match is found, returns HTTP 200 with an empty list.","failureModes":["Invalid RE2 pattern syntax returns an error (RE2 does not support lookaheads or backreferences)","Input text exceeding 1,000,000 characters is rejected","Pattern exceeding 4,096 characters is rejected","Payment failure or insufficient USDC balance returns a 402 error","Network timeout on very large inputs"],"whenToPreferThis":"Choose this endpoint when you need structured extraction of regex matches — including capture group values and character offsets — not just a boolean yes/no. Prefer it over the sibling /test endpoint when you need the matched text or group values, and over the sibling /replace endpoint when you want to inspect matches rather than transform the string. The RE2 engine guarantees linear-time matching, making it safe for untrusted or user-supplied patterns.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:31:37.811Z","isFirstParty":false}