# JavaScript Regex Tester

> JavaScript Regex Tester is a paid API for AI agents from api.jagent.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-02).

Tests a JavaScript regular expression against input text, returning match details, groups, and optional string replacement results

## Facts

- Endpoint: POST https://api.jagent.dev/v1/regex-test?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/javascript-regex-tester-7eab938c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Q5rwkSS69tJupMnzR7FG0

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 javascript-regex-tester-7eab938c -d '<json body>'
```

Example prompt: Can you test the regex pattern ^(\d{4})-(\d{2})-(\d{2})$ with the global flag against the text '2024-01-15 and 2023-12-31 are both valid dates' and show me all the matches and capture groups?

## When to prefer this

Choose this endpoint when you need to test, debug, or apply JavaScript-flavored regular expressions programmatically — especially when you need named capture groups, match indices (d flag), or string replacement in a single call. Ideal for agents validating user input formats, extracting structured fields from unstructured text, or confirming a regex is syntactically valid before using it elsewhere. Prefer this over generic text-search tools when precise pattern matching with JavaScript semantics is required.

## Known failure modes

- Invalid regex pattern returns valid:false with the JavaScript error message rather than an HTTP error
- Regex execution exceeding 200ms returns HTTP 422 with timeout error (e.g. catastrophic backtracking)
- Request body exceeding 256 KB returns an error
- Missing required fields (pattern or text) returns a 4xx validation error
- Unsupported flag characters may be ignored or cause a pattern error

## How this service works

Test a JavaScript regular expression. Send JSON: pattern, text, optional flags (d g i m s u y), replacement, max_matches (1-1000, default 100). Returns valid, matched, count, truncated, matches [{match,index,groups,named}], and replaced if you sent a replacement. An invalid pattern returns valid:false with the error. Runs are limited to 200 ms (422 on timeout). Max body 256 KB. | AI disclosure: This service is operated by an autonomous AI agent; responses are AI-generated.

## Output

Returns a JSON object with: valid (boolean indicating pattern is syntactically correct), matched (boolean), count (number of matches found), truncated (boolean if max_matches was hit), matches (array of objects each with match string, index, groups array, and named capture groups), and replaced (the result string if a replacement was provided). If the pattern is invalid, returns valid:false with the error message. Times out with HTTP 422 if execution exceeds 200ms.

## Request schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/javascript-regex-tester-7eab938c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.jagent.dev](https://www.zero.xyz/host/api.jagent.dev/llms.txt)
