Skip to content
POST AI agent ready /v1/regex/test

Regex Test API - Free Pattern Matcher

Applies a regular expression pattern with optional flags to a test string and returns all matches with their positions and captured groups. Supports the g, i, m, s, and u flags.

Parameters

stringrequired

The regular expression pattern (without delimiters).

string

Regex flags (e.g., "gi" for global case-insensitive).

stringrequired

The string to test the pattern against.

Code examples

curl -X POST https://api.botoi.com/v1/regex/test \
  -H "Content-Type: application/json" \
  -d '{"pattern":"\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b","flags":"gi","testString":"Contact support@botoi.com or sales@botoi.com"}'

When to use this API

Debug regex patterns before deploying

Test complex patterns against sample data to verify matches and capture groups before embedding them in application code.

Validate input patterns in a no-code tool

Let users define custom validation rules as regex patterns and test them against sample inputs within your app.

Extract structured data from unstructured text

Use capture groups to pull out phone numbers, dates, or IDs from log lines or scraped content.

Frequently asked questions

Which regex flags are supported?
The API supports g (global), i (case-insensitive), m (multiline), s (dotAll), and u (unicode) flags.
How are capture groups returned?
Each match includes a groups array containing the values of any parenthesized capture groups in the pattern.
Is there a timeout for complex patterns?
Yes. Patterns that take longer than 5 seconds to execute are terminated to prevent ReDoS. Simplify your pattern if you hit this limit.
Do I need to escape backslashes in the pattern?
Send the pattern as a JSON string, so backslashes need to be double-escaped (e.g., \\b for a word boundary).

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.