# RelayStation Regex Extract

> RelayStation Regex Extract is a paid API for AI agents from api.relaystation.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-16).

Extracts all regex pattern matches from a text string, with ReDoS protection and bounded inputs.

## Facts

- Endpoint: POST https://api.relaystation.ai/v1/text/regex-extract
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/relaystation-regex-extract-d5b119f9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-H-9G-v1HqzykF6oND7Tt

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 relaystation-regex-extract-d5b119f9 -d '<json body>'
```

Example prompt: Extract all email addresses from this text using the pattern [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}: 'Please contact support@example.com or sales@acme.org for help. Billing issues go to billing@company.co.uk.'

## When to prefer this

Choose this endpoint when you need safe, server-side regex extraction without spinning up your own compute — especially useful when the pattern or input is user-supplied and ReDoS risk is a concern. Prefer it over client-side regex when you want bounded, predictable execution in an agentic pipeline. Best for structured field extraction (emails, phone numbers, codes, dates) from unstructured text at low cost.

## Known failure modes

- Regex pattern flagged as potentially ReDoS-dangerous — request rejected with an error
- Input text exceeds size bound — rejected with payload-too-large error
- Malformed regex syntax — returns parse error with description
- No matches found — returns empty array (not an error)
- Insufficient USDC balance below 1¢ minimum — payment rejected

## How this service works

$0.0002/MB. Extract regex matches from text — ReDoS-guarded, patterns and input bounded. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny

## Output

Returns a JSON array of all matches found in the input text for the given regex pattern, including matched strings and optionally their positions or capture group values. If no matches are found, returns an empty array. ReDoS-guarded execution ensures safe evaluation of user-supplied patterns.

## Request schema (JSON Schema)

```json
{
 "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",
     "properties": {
      "file": {
       "type": "object",
       "description": "cputools input-source: { inline: <base64 ≤ 4 MiB> } or { inputKey: <scratch key from /v1/cputools/upload-url, ≤ 50 MB> }."
      },
      "text": {
       "type": "string",
       "minLength": 1
      },
      "flags": {
       "type": "string",
       "pattern": "^[gimsuy]*$",
       "maxLength": 8
      },
      "pattern": {
       "type": "string",
       "maxLength": 1024,
       "minLength": 1
      },
      "maxMatches": {
       "type": "integer",
       "maximum": 100000,
       "minimum": 1
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/relaystation-regex-extract-d5b119f9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.relaystation.ai](https://www.zero.xyz/host/api.relaystation.ai/llms.txt)
