---
title: "Test a regular expression"
method: POST
path: "/v1/tools/regex_test"
---

# Test a regular expression

`POST /v1/tools/regex_test`

## Request

- Base URL: `https://mcp.cleanor.app`
- URL: `https://mcp.cleanor.app/v1/tools/regex_test`
- Auth: none declared

Test a JavaScript regular expression against sample text and return whether it matches, plus every match with its captured groups and index. Use to verify a pattern instead of reasoning about it in your head. Input and pattern are length-capped to keep it fast and safe.

## Request body

- object
  - `pattern` string, required: The regex pattern (without slashes).
  - `input` string, required: Text to test against.
  - `flags` string: Regex flags, e.g. "gi". Allowed: g i m s u y d.

## Response `200`

Tool result: `data` (structured) and `text` (human-readable).

- ToolResult
  - `ok` boolean
  - `tool` string
  - `data` object, nullable
  - `text` string
  - `attribution` string

## Other responses

- `400`: Invalid arguments.
- `429`: Rate limited (120 requests per minute per IP).

---

[API](https://skmtc.dev/cleanor/apis/cleanor-api.md) · [All operations](https://skmtc.dev/cleanor/apis/cleanor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cleanor/apis/cleanor-api/revisions/5f7be54e7a84?raw)
