{"uid":"cap_rcy29Hk3BoBFd6Aap8otY","slug":"regex-openverbs-com-re2-split-7a11b1d2","name":"regex.openverbs.com RE2 Split","description":"Split the input into parts on each match of a RE2 pattern. An optional limit caps the number of parts (0 = unlimited). Returns the parts array and its count.","url":"https://regex.openverbs.com/v1/split","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":{"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."},"limit":{"type":"integer","maximum":100000,"minimum":0,"description":"Maximum number of parts. 0 or omitted = unlimited."},"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_ecrqtCL2L6UyTVtK7YyFr","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":"Splits a text string into parts wherever a RE2 regular expression pattern matches, returning an array of substrings and the count of parts.","exampleAgentPrompt":"Split this log line '2024-01-15 ERROR [auth] Connection timeout after 30s' on whitespace using the RE2 pattern \\\\s+ and give me back all the parts.","exampleUseCases":[{"title":"Tokenizing CSV row into fields","prompt":"Take this CSV row 'Alice,30,New York,Engineer' and split it on commas using the RE2 pattern , so I get each field as a separate part."},{"title":"Breaking log file entries into segments","prompt":"Split this Apache log entry '127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] GET /apache_pb.gif 200' into parts wherever there's one or more spaces, using the RE2 pattern \\\\s+, and limit the result to 6 parts."},{"title":"Splitting multi-line text into lines","prompt":"I have this block of text with Windows line endings and I want to split it into individual lines — use the RE2 pattern \\\\r?\\\\n to split it up and return all the parts."}],"resultDescription":"Returns a JSON object containing a 'parts' array of substring strings (the pieces of the input text between pattern matches) and a 'count' integer indicating how many parts were produced. If limit is set, at most that many parts are returned, with any remaining text folded into the last part.","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 string exceeding 4,096 characters is rejected","Limit value outside 0–100,000 is rejected","Missing required 'pattern' or 'input' fields returns a validation error","Payment failure or insufficient balance returns a 402 response"],"whenToPreferThis":"Choose this endpoint when you need to split text using a regular expression pattern rather than a fixed literal string, especially when delimiter complexity requires regex (e.g. variable whitespace, alternation, character classes). Prefer it over simple string-split utilities when you need RE2's guaranteed linear-time safety (no catastrophic backtracking), a configurable part limit, or optional case-insensitive/multiline/dotall flags. Best for structured text parsing, log tokenization, or any scenario where delimiter patterns vary.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:30:22.636Z","isFirstParty":false}