# agent402.tools Regex Match

> agent402.tools Regex Match is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Runs a JavaScript-syntax regular expression against provided text and returns up to 100 matches with their indices and capture groups.

## Facts

- Endpoint: POST https://agent402.tools/api/regex
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-regex-match-e046a273
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_6q-9pEJn3ONLucq44hMnn

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 agent402-tools-regex-match-e046a273 -d '<json body>'
```

Example prompt: Find all email addresses in this text using the pattern `[\w.+-]+@[\w-]+\.[\w.]+` with global and case-insensitive flags: 'Contact us at support@example.com or sales@ACME.org for more info.'

## When to prefer this

Use this endpoint when you need structured regex match results with indices and capture groups from arbitrary text, especially in an agent pipeline where downstream steps depend on positional or grouped match data. Prefer this over client-side regex when the agent environment lacks regex support or when you need a consistent, sandboxed execution environment.

## Known failure modes

- Pattern exceeds 200 character limit — returns validation error
- Text exceeds 10KB limit — returns payload-too-large error
- Invalid regex syntax (JS-flavor) — returns pattern parse error
- No matches found — returns empty array
- Invalid flags string — returns flag validation error

## How this service works

Run a regular expression against text. Returns up to 100 matches with index and capture groups. Pattern ≤ 200 chars, text ≤ 10KB.

## Output

An array of up to 100 match objects, each containing the matched string, its start index within the text, and any named or numbered capture group values extracted by the pattern.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Text to search (max 10KB)"
  },
  "flags": {
   "type": "string",
   "description": "Regex flags, e.g. gi (default g)"
  },
  "pattern": {
   "type": "string",
   "description": "Regex pattern (JS syntax, max 200 chars)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "matches": [
   {
    "index": 11,
    "match": "a@b.com",
    "groups": [
     "a",
     "b.com"
    ]
   }
  ],
  "matchCount": 1
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-regex-match-e046a273/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
