Regex Tester - Matches, Groups, Explanation, ReDoS Warnings avatar

Regex Tester - Matches, Groups, Explanation, ReDoS Warnings

Pricing

from $0.40 / 1,000 tested patterns

Go to Apify Store
Regex Tester - Matches, Groups, Explanation, ReDoS Warnings

Regex Tester - Matches, Groups, Explanation, ReDoS Warnings

Test up to 50 regex patterns against sample text by API: all matches with indexes + named groups, plain-English pattern explanation, ReDoS heuristics and a 4s time-box so catastrophic patterns report instead of hanging.

Pricing

from $0.40 / 1,000 tested patterns

Rating

0.0

(0)

Developer

Broke to Built

Broke to Built

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

6 days ago

Last modified

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
}

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: pattern or patterns, plus text
  • Returns: one record per pattern; matches + warnings summarize the result
  • Bounded: 50 patterns, 200k chars text, 4s matching budget per pattern
  • Side effects: none (text never leaves the run)