# x402 Utils – Regex Match & Replace (RE2)

> x402 Utils – Regex Match & Replace (RE2) is a paid API for AI agents from qcb7fnxsbd7fbhj4.68r.lambda-web.us-east-1.on.aws, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-29).

Runs a RE2 regular expression on a text, returning all matches with positions and capture groups, plus an optional replacement result.

## Facts

- Endpoint: POST https://qcb7fnxsbd7fbhj4.68r.lambda-web.us-east-1.on.aws/v1/regex?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-utils-regex-match-replace-re2-3c533193
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0De3GfG4eUqstIUXdLHqb

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-utils-regex-match-replace-re2-3c533193 -d '<json body>'
```

Example prompt: Find all dates in ISO format (like 2026-10-15) in this text using the pattern `(\d{4})-(\d{2})-(\d{2})` and replace them with the format DD/MM/YYYY using `$3/$2/$1`: 'Meeting on 2026-10-15 and follow-up on 2027-01-03.'

## When to prefer this

Choose this endpoint when you need server-side, guaranteed linear-time regex execution (RE2) without risk of catastrophic backtracking, when you need both match extraction (positions + groups) and replacement in a single call, or when your runtime doesn't have a regex engine available. Prefer over client-side solutions when working with untrusted patterns that could cause ReDoS vulnerabilities, or when you need named capture groups and positional indices reliably returned as structured JSON.

## Known failure modes

- Invalid RE2 pattern syntax returns an error — RE2 does not support lookahead, lookbehind, or backreferences
- Text exceeding 1 MB will be rejected
- Pattern exceeding 2000 characters will be rejected
- Invalid flag characters (anything other than i, m, s) will cause an error
- Payment failure or missing x402 payment header returns 402 status

## How this service works

Run a regular expression on a text: every match with its position and capture groups (named too), and the text with a replacement applied. RE2 syntax, which runs in linear time (no lookaround or backreferences).

## Output

Returns a JSON object with: `matched` (boolean), `count` (number of matches), `matches` array (each with `index`, `match` string, `groups` array of positional captures, `named` map of named captures), and `replaced` (the full text with the replacement applied, if a replacement was provided).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "the text (up to 1 MB)"
  },
  "flags": {
   "type": "string",
   "description": "any of i (ignore case), m (multiline), s (dot matches newline)"
  },
  "pattern": {
   "type": "string",
   "description": "the pattern (up to 2000 characters)"
  },
  "replacement": {
   "type": "string",
   "description": "optional replacement, $1 for groups"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 2,
  "matched": true,
  "matches": [
   {
    "index": 5,
    "match": "2026-10",
    "named": {
     "year": "2026"
    },
    "groups": [
     "2026",
     "10"
    ]
   }
  ],
  "replaced": "from 10/2026 to 01/2027"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-utils-regex-match-replace-re2-3c533193/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from qcb7fnxsbd7fbhj4.68r.lambda-web.us-east-1.on.aws](https://www.zero.xyz/host/qcb7fnxsbd7fbhj4.68r.lambda-web.us-east-1.on.aws/llms.txt)
