# Compute API – Regex Match

> Compute API – Regex Match is a paid API for AI agents from compute-api-production-245d.up.railway.app, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-11).

Tests a string against a regex pattern and returns match status, matched substrings, and capture groups

## Facts

- Endpoint: POST https://compute-api-production-245d.up.railway.app/regex?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/compute-api-regex-match-3470d9ae
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Y4BkGiGykuM-fcjA78-O9

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 compute-api-regex-match-3470d9ae -d '<json body>'
```

Example prompt: Test whether the string 'user@example.com' matches the regex pattern '[\w.+-]+@[\w-]+\.[a-z]{2,}' using the 'i' flag, and tell me if it matches and what the capture groups are.

## When to prefer this

Use this endpoint when you need server-side regex evaluation without running code locally, especially in agent workflows where executing arbitrary code is not available. Ideal for validating user input formats (emails, phone numbers, URLs), extracting structured data from unstructured text, or checking log lines against patterns. At $0.001 per call it is cost-effective for low-to-moderate volume use cases that need pay-per-call billing via x402 on Base with no subscription required.

## Known failure modes

- Invalid regex pattern syntax causes a 400/500 error response
- Missing required fields 'test' or 'pattern' returns a validation error
- Unsupported or malformed regex flags may cause errors
- Payment failure or insufficient USDC balance on Base returns a 402 error
- Catastrophic backtracking on complex patterns against long strings may cause timeout

## How this service works

Pure computation endpoints paid per call via x402 ($0.001 USDC on Base).

## Output

Returns a JSON object with: 'match' (boolean indicating whether the pattern matched), 'matches' (array of matched substrings found in the input), and 'groups' (array of capture group arrays for each match, entries may be null for unmatched optional groups).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "test",
  "pattern"
 ],
 "properties": {
  "test": {
   "type": "string",
   "description": "String to test against"
  },
  "flags": {
   "type": "string",
   "description": "Regex flags, e.g. gi"
  },
  "pattern": {
   "type": "string",
   "description": "Regex pattern (no slashes)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "match": {
   "type": "boolean"
  },
  "groups": {
   "type": "array",
   "items": {
    "type": "array",
    "items": {
     "type": [
      "string",
      "null"
     ]
    }
   }
  },
  "matches": {
   "type": "array",
   "items": {
    "type": "string"
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/compute-api-regex-match-3470d9ae/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from compute-api-production-245d.up.railway.app](https://www.zero.xyz/host/compute-api-production-245d.up.railway.app/llms.txt)
