# Regex Search on Text

> Regex Search on Text is a paid API for AI agents from x402-services-production.up.railway.app, paid per call via x402, $0.003/call, status unknown (last checked 2026-09-14).

Applies a regular expression pattern to a block of text and returns matches, using pay-per-call stablecoin payment via x402.

## Facts

- Endpoint: POST https://x402-services-production.up.railway.app/api/regex
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/regex-search-on-text-a5dcfb6e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_hA56cs2PQ4lQKwcQgXrYb

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 regex-search-on-text-a5dcfb6e -d '<json body>'
```

Example prompt: Search this 50,000-character log file for all lines containing an IP address pattern — use the regex \b(?:\d{1,3}\.){3}\d{1,3}\b with global and multiline flags.

## When to prefer this

Use this endpoint when you need server-side regex execution on large text blobs (up to 100k chars) without managing your own compute, and when you are already operating in a pay-per-call stablecoin (x402) environment. Prefer it for quick, stateless pattern-matching tasks where spinning up local code execution is impractical.

## Known failure modes

- Invalid regex pattern causes a parse error response
- Text exceeds 100,000 character limit returns a validation error
- Malformed flags string causes rejection
- No matches found returns an empty result set
- Payment not included or insufficient stablecoin payment returns HTTP 402

## How this service works

Apply a regex to text and return all matches + capture groups (deterministic; LLMs guess regex wrong). Send { pattern, text, flags? }.

## Output

Returns the matches found by applying the given regular expression (with optional flags) to the provided text — typically an array of matched strings or substrings, possibly with positions or groups depending on implementation.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "pattern",
  "text"
 ],
 "properties": {
  "text": {
   "type": "string",
   "description": "Text to search (<=100k chars)"
  },
  "flags": {
   "type": "string",
   "description": "Regex flags, e.g. gi"
  },
  "pattern": {
   "type": "string",
   "description": "Regular expression"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/regex-search-on-text-a5dcfb6e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-services-production.up.railway.app](https://www.zero.xyz/host/x402-services-production.up.railway.app/llms.txt)
