# JavaScript Regex Tester

> JavaScript Regex Tester is a paid API for AI agents from dev-utils.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-04).

Runs a JavaScript regex pattern against text and returns all matches, capture groups, and character indexes, with catastrophic-backtracking protection.

## Facts

- Endpoint: GET https://dev-utils.x402tookit.com/regex-test?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-04
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/javascript-regex-tester-76124a58
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_wQBc-Hh3FZukz3To3WNjl

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-76124a58
```

Example prompt: Run the regex pattern `(\d{4})-(\d{2})-(\d{2})` with the global flag on this text: 'Meeting on 2024-03-15 and follow-up on 2024-04-02, deadline 2025-01-01' — give me all matches, groups, and their positions.

## When to prefer this

Use this endpoint when you need server-side JavaScript regex execution with safety guarantees against catastrophic backtracking, especially when the regex or input text is user-supplied and could cause a ReDoS attack in a local environment. Prefer this over running regex locally when you need a sandboxed, time-budgeted execution environment or when you need detailed match metadata including indexes and named groups.

## Known failure modes

- Regex times out due to catastrophic backtracking — timedOut flag is set to true and partial results may be returned
- Input text exceeds 20000 characters — text is truncated and truncated flag is set
- Regex pattern exceeds 500 characters — request rejected
- Invalid regex syntax — error response returned
- Invalid flags provided — request rejected or flags ignored

## How this service works

Run a JS regex on text: matches, groups, indexes. Capped input and a time budget stops catastrophic backtracking.

## Output

Returns a list of match objects each containing the matched string, start index, end index, positional capture groups, and named capture groups. Also returns match count, flags used, execution time in ms, and boolean flags for timeout, truncation, and degraded mode if input was too large or the regex ran too long.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "pattern",
      "text"
     ],
     "properties": {
      "text": {
       "type": "string",
       "description": "Text to search, up to 20000 chars"
      },
      "flags": {
       "type": "string",
       "description": "Any of gimsuyd, default g (without g only the first match is returned)"
      },
      "pattern": {
       "type": "string",
       "description": "JavaScript regex source without slashes, up to 500 chars"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "tookMs": {
       "type": [
        "null",
        "number"
       ]
      },
      "matches": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "end": {
          "type": [
           "null",
           "number"
          ]
         },
         "index": {
          "type": [
           "null",
           "number"
          ]
         },
         "match": {
          "type": [
           "null",
           "string"
          ]
         },
         "named": {
          "type": [
           "null",
           "object"
          ],
          "properties": {
           "year": {
            "type": [
             "null",
             "string"
            ]
           }
          }
         },
         "groups": {
          "type": [
           "array",
           "null"
          ],
          "items": {
           "type": "string"
          }
         }
        }
       }
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ]
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
    
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/javascript-regex-tester-76124a58/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from dev-utils.x402tookit.com](https://www.zero.xyz/host/dev-utils.x402tookit.com/llms.txt)
