South Star

Regex Tester Explainer Match Replace ReDoS Check API

Free tier included · Tools
Test regular expressions safely with match, replace, split, validate, pattern breakdown, and built-in ReDoS protection.

The Regex Tester & Explainer API provides a secure environment for testing, explaining, splitting, and validating regular expressions in Python `re` syntax without risking Denial of Service (DoS) attacks on your application. Running untrusted regular expressions from users or external systems can easily lead to catastrophic backtracking (ReDoS), causing your server to hang indefinitely. This API eliminates that risk with two layers of defense: `regexploit` static analysis to reject cubic or exponential patterns upfront, and isolated worker processes with a hard 2-second timeout for execution.

Beyond core matching and search-and-replace with named and numbered group backreferences, this service includes endpoints to split text, validate pattern syntax without running it, check for ReDoS vulnerabilities explicitly, and access a built-in library of common verified regular expression patterns (such as email, URL, IP, and ISO date). Compared to leading market alternatives, it offers robust enterprise-grade safety features at a much lower cost.

Endpoints available: - **POST /match** - Match - **POST /explain** - Explain - **POST /replace** - Replace - **POST /redos** - Redos - **POST /split** - Split text by regular expression - **POST /validate** - Validate regex syntax - **GET /library** - Get common regular expression patterns library

Limits and constraints: patterns are limited to a maximum of 1,000 characters, input text to 1MB (1,048,576 characters), and a maximum of 1,000 matches are reported per request. The service operates completely offline and statelessly. Note that the pattern explainer (`/explain`) provides a best-effort human-readable tokenizer rather than a full structural parser.

Endpoints

MethodPathWhat it does
GET/API root metadata and entry point.
GET/healthLiveness probe checking service operational status.
POST/matchFind all occurrences of a regular expression pattern in text, returning spans and groups.
POST/explainBreak down a regular expression pattern into human-readable components.
POST/replaceSearch and replace text using a regular expression pattern and replacement template.
POST/redosAnalyze a regular expression pattern for ReDoS vulnerabilities without executing it.
POST/splitSplit text using a regular expression pattern as delimiters.
POST/validateVerify if a regular expression pattern compiles successfully.
GET/libraryRetrieve a collection of ready-to-use common regular expression patterns.

Quick start

curl -X POST "https://regexpt.p.rapidapi.com/match" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: regexpt.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{"pattern": "(\\w+)@(\\w+)", "text": "write to user@example or admin@example", "flags": ["IGNORECASE"]}'

FAQ

How does the API protect against ReDoS (Denial of Service)?

We use a two-layer defense system: static analysis via `regexploit` to detect cubic or exponential backtracking before execution, combined with isolated worker processes running with a hard 2-second timeout.

What happens if a pattern takes too long to execute?

If a pattern bypasses static filtering and exceeds the 2-second timeout, the worker process is terminated immediately and the API returns a `422 regex_timeout` error, preventing server hangs.

Are my input texts and patterns stored or logged?

No. The service is entirely stateless and offline. Your queries and text data are processed in memory and never written to a persistent database or log.

What regex syntax is supported?

The API supports standard Python `re` syntax, including named and numbered groups, along with case-insensitive flag names and short forms (`IGNORECASE`, `MULTILINE`, `DOTALL`, `ASCII`, `VERBOSE`, `i`, `m`, `s`, `a`, `x`).

Try Regex Tester Explainer Match Replace ReDoS Check free

Free tier on every plan. Get an API key and start calling in under a minute.

Open on RapidAPI

Related APIs