# 24K Labs Regex Tester

> 24K Labs Regex Tester is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-13).

Tests a regular expression pattern against input text and returns full match details including capture groups, named groups, and span positions.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/regex-test
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24k-labs-regex-tester-c79af939
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_R70c3d8HYd4sAk_bxCTqC

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 24k-labs-regex-tester-c79af939 -d '<json body>'
```

Example prompt: Test this regex pattern `(\d{4})-(\d{2})-(\d{2})` against the text 'Order placed on 2024-03-15, shipped 2024-04-01' and show me all the matches, capture groups, and their positions in the string.

## When to prefer this

Choose this endpoint when you need programmatic regex testing with structured output — especially when you need machine-readable span positions, capture groups, or named groups rather than a simple yes/no match check. Ideal for agents that need to extract structured data from unstructured text using patterns, debug regex behavior, or validate regex correctness against sample input. Prefer over generic string search when group extraction or position data is required.

## Known failure modes

- Invalid regex pattern returns a parse error describing the syntax issue
- No matches found returns an empty matches array rather than an error
- Unsupported regex flags may result in an error or be silently ignored
- Very large input text or catastrophic backtracking patterns may cause timeout
- Malformed request body (missing pattern or text) returns a 400-level error

## How this service works

Test a regex against text; returns matches, capture and named groups, and spans.

## Output

Returns an array of match objects for each occurrence found in the input text. Each match includes the full matched string, an array of indexed capture groups, a map of named capture groups (if the pattern uses named groups), and the start/end character position (span) of the match within the input text.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string"
  },
  "flags": {
   "type": "string"
  },
  "pattern": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "match_count": 2
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/24k-labs-regex-tester-c79af939/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
