๐Ÿ”

Regex API

Test regex patterns, find all matches with named capture groups, or perform replacements. Runs locally โ€” zero latency, zero external API calls.

API Docs $0.001 / request

About this tool

Test and extract data using regular expressions. Supports four modes: test (boolean match), match (first match with groups), matchAll (all matches up to 1000), and replace (find and replace). Full support for named capture groups, all JavaScript regex flags (g, i, m, s, u, y). Runs entirely locally โ€” no external API calls.

Quick Start โ€” Find All Matches

curl -X POST https://api.iteratools.com/text/regex \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "pattern": "(?P<year>\\d{4})-(?P<month>\\d{2})-(?P<day>\\d{2})", "text": "Events on 2026-03-29 and 2026-04-15", "mode": "matchAll" }'

Response (matchAll)

{ "ok": true, "data": { "mode": "matchAll", "pattern": "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})", "flags": "g", "matches": [ { "match": "2026-03-29", "index": 10, "groups": ["2026", "03", "29"], "namedGroups": { "year": "2026", "month": "03", "day": "29" } }, { "match": "2026-04-15", "index": 25, "groups": ["2026", "04", "15"], "namedGroups": { "year": "2026", "month": "04", "day": "15" } } ], "count": 2 } }

Test Mode Example

curl -X POST https://api.iteratools.com/text/regex \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", "text": "user@example.com", "mode": "test"}'
{ "ok": true, "data": { "mode": "test", "pattern": "...", "flags": "", "matches": true } }

Parameters

  • pattern (required) โ€” Regex pattern (max 500 chars)
  • text (required) โ€” Text to match against (max 100KB)
  • flags (optional) โ€” Regex flags: g, i, m, s, u, y
  • mode (optional) โ€” test, match, matchAll (default), or replace
  • replacement (required for replace mode) โ€” Replacement string, supports $1, $<name> backreferences

Modes

  • test โ€” Returns { matches: true/false }. Quick boolean check.
  • match โ€” Returns first match with index, groups, and named groups.
  • matchAll โ€” Returns all matches (up to 1000) with groups. Auto-adds g flag.
  • replace โ€” Find and replace. Returns result string, replacement count, and lengths.

Use Cases

  • Extract emails, URLs, phone numbers, dates from unstructured text
  • Validate input formats (emails, IPs, postal codes) in AI workflows
  • Parse log files and extract structured fields with named groups
  • Clean and transform text with regex replacements
  • Test regex patterns before embedding them in code
  • Extract data from HTML/XML snippets without a full parser

Pricing & Limits

  • $0.001 per request via x402 micropayment on Base (USDC)
  • Max text size: 100KB
  • Max pattern length: 500 chars
  • Max matches (matchAll): 1000
  • No external API calls โ€” instant response
Full Documentation Browse All Tools