---
title: "Test regex pattern"
method: POST
path: "/api/v1/static-policies/test"
tags: ["Static Policies"]
deprecated: true
---

# Test regex pattern

`POST /api/v1/static-policies/test`

## Request

- Base URL: `https://agent.getaxonflow.com`
- URL: `https://agent.getaxonflow.com/api/v1/static-policies/test`
- Auth: none declared
- TypeScript: <https://skmtc.dev/getaxonflow/apis/axonflow-agent-api/docs/api/v1/static-policies/test/post.ts> (a function with typed inputs; its response is checked against the schema)

> **Deprecated.**

Tests a regex pattern against input strings without creating a policy.

Useful for validating patterns before creating policies.
Has a 5-second timeout to prevent ReDoS attacks.

The pattern is compiled as written. The engine compiles a stored
pattern in the SQL-injection and destructive-command categories
case-insensitively, so for those categories prefix `(?i)` to test
what the engine matches.

## Request body

- TestPatternRequest: Request body for testing a regex pattern
  - `pattern` string, required: Regex pattern to test
  - `input` string: Single input string to test (for backward compatibility)
  - `inputs` string[]: Multiple input strings to test

## Response `200`

Pattern test results

- TestPatternResponse: Response from pattern testing
  - `valid` boolean: Whether the pattern is valid regex
  - `results` object[]
    - `input` string: The input that was tested
    - `matched` boolean: Whether the pattern matched
    - `matches` string[]: Captured match groups
  - `error` string: Error message if pattern is invalid

## Other responses

- `400`: Invalid request body or pattern

---

[API](https://skmtc.dev/getaxonflow/apis/axonflow-agent-api.md) - [All operations](https://skmtc.dev/getaxonflow/apis/axonflow-agent-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getaxonflow/apis/axonflow-agent-api/revisions/34d30fcb7fa1?raw)
