Regex Tester API - Matches, Groups, ReDoS Warnings
Pricing
from $0.40 / 1,000 tested patterns
Regex Tester API - Matches, Groups, ReDoS Warnings
Tests regex patterns against sample text, up to 50 per run, with a 4-second time-box so catastrophic patterns report instead of hanging. Returns every match with its index and named groups, a plain-English explanation and ReDoS warnings. For developers, data engineers and security reviewers.
Pricing
from $0.40 / 1,000 tested patterns
Rating
0.0
(0)
Developer
Broke to Built
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
14 days ago
Last modified
Categories
Features
Share
Regex Tester — Matches, Groups, Plain-English Explanation, ReDoS Warnings
Test regular expressions against sample text by API — with everything a regex playground shows, returned as JSON: all matches with indexes, capture groups and named groups, a step-by-step plain-English explanation of the pattern, and heuristic ReDoS (catastrophic backtracking) warnings. Up to 50 patterns per run against the same text, online, by API, or as an agent tool via Apify MCP.
What you get
- matches — every match:
{match, index, groups, namedGroups} - matchCount, sanitized flags
- explanation — the pattern decoded token by token ("Match a named group "user"… Match a literal "@"…")
- warnings — nested quantifiers, adjacent unbounded quantifiers, quantified alternations (the classic ReDoS shapes), plus truncation notices
- timedOut — matching is time-boxed at 4s, so a catastrophic pattern reports instead of hanging
- Fail-soft: an invalid pattern never fails the run — it returns
{ok: false, error}and is never charged.
Input
{"pattern": "(?<user>\\w+)@(?<domain>[\\w.]+)","text": "Contact alice@example.com or bob@test.org","flags": "gi"}
Bulk: { "patterns": ["\\d+", "[a-z]+"], "text": "..." } — each pattern gets its own record.
Output (real run, trimmed)
{"pattern": "(?<user>\\w+)@(?<domain>[\\w.]+)","ok": true,"matchCount": 2,"matches": [{"match": "alice@example.com","index": 8,"groups": ["alice", "example.com"],"namedGroups": { "user": "alice", "domain": "example.com" }}],"explanation": "Pattern /(?<user>\\w+)@(?<domain>[\\w.]+)/g\nSteps:\n1. Begin a named group \"user\"\n2. Match a word character (a-z, A-Z, 0-9, _) (one or more times)\n...","warnings": [],"timedOut": false}
Example
A real run on 2026-10-31 with the input this page's form is prefilled with:
{"pattern": "(?<user>\\w+)@(?<domain>[\\w.]+)","text": "Contact alice@example.com or bob@test.org for details.","flags": "g","patterns": ["d+","[a-z]+@[a-z.]+"]}
It finished in 2 seconds and returned 2 results. It was charged for 2 test-run events ($0.001 on the Free plan). The first result (long text and lists cut for display):
{"pattern": "d+","ok": true,"flags": "g","matchCount": 1,"matches": [{"match": "d","index": 46,"groups": [],"namedGroups": {}}],"explanation": "Pattern /d+/g\nFlags: global (find all matches)\nSteps:\n1. Match the literal text \"d\" (one or more times)","warnings": [],"timedOut": false,"textLength": 54}
Pricing
$0.0005 per pattern tested. No start fee. Invalid patterns are never charged.
Measured against store incumbents (2026-08-07): perryay/regex-lab charges $0.008 start + $0.001 per item, rl1987/regex-helper $0.01 per start. A 50-pattern validation sweep here costs $0.025 vs $0.05+ there.
Honest limits
- JavaScript (ECMAScript) regex dialect — no PCRE-only features (recursion, atomic groups, possessive quantifiers).
- ReDoS detection is heuristic pattern-shape analysis plus a hard 4s execution time-box: shapes it flags are worth rewriting, but absence of a warning is not a formal safety proof.
- Text capped at 200k chars, matches at 5,000 per pattern (a warning tells you when truncation happened).
- The explanation covers mainstream syntax; exotic constructs fall back to literal descriptions.
FAQ
Can I use this in CI to validate user-supplied patterns?
Yes — that is the API-first point: reject patterns that error, warn on ReDoS shapes, and assert expected matchCount against fixture text.
What flags are supported?
d, g, i, m, s, u, y — invalid characters are stripped, and g is always enforced so all matches are collected.
How does the time-box protect me?
A pattern like (a+)+$ on adversarial input can hang a naive tester for minutes. Here matching stops at 4s, timedOut: true is set, and the ReDoS warning tells you why.
Do named groups work?
Fully — namedGroups maps each name to its captured value per match.
Why did some rows come back ok: false?
The pattern failed to compile (syntax error) or exceeded the 2,000-char pattern cap. Recorded with the exact error, never charged.
Use from code or AI agents
curl -s "https://api.apify.com/v2/acts/EliAI~regex-tester/run-sync-get-dataset-items?token=$APIFY_TOKEN" \-X POST -H 'Content-Type: application/json' \-d '{"pattern": "\\bhttps?://\\S+", "text": "see https://example.com and http://test.org"}'
Agents: connect Apify MCP and call the EliAI/regex-tester tool.
- Capability: test one or many regex patterns against sample text — matches, groups, explanation, ReDoS warnings
- Required input:
patternorpatterns, plustext - Returns: one record per pattern;
matches+warningssummarize the result - Bounded: 50 patterns, 200k chars text, 4s matching budget per pattern
- Side effects: none (text never leaves the run)
Who uses it
- Developers testing a pattern's matches and named groups against sample text
- Data engineers checking an extraction regex before running it on a large dataset
- Security reviewers checking user-supplied patterns for ReDoS risk
- Log analysts refining a pattern that pulls fields out of log lines
- Educators explaining what a regex does step by step to students
Changelog
- 2026-11-01: Page text only: an Example section from a real run. Code, output and price are unchanged.