iT IvyIvy Tools Privacy-First Client Utilities

Interactive Regex Tester & Visualizer

Client-Side Live Matcher

Test, visualize, and export regular expressions. Everything runs locally — nothing is sent.

Regex input & controls

Choosing a preset fills the pattern, flags, and a sample test string instantly.

0 chars

Privacy-First: Matching runs 100% in your browser with zero server transmission. Patterns and samples never leave this tab.

0 flags • 0 pattern chars ReDoS guard on

Workflow

How to Test and Debug Regular Expressions Online

Regex bugs hide in plain sight — one greedy quantifier and a validator accepts garbage. The loop is always the same: express the intent, run it against hostile samples, read the group breakdown, then export the proven pattern into real code.

  1. 01

    Type a pattern, pick flags

    Write the expression between the slashes, toggle g / i / m / s / u, or jump-start from a preset — Email, IPv4, UUID, and four more ship with sample text.

  2. 02

    Paste the test string

    Drop logs, form input, or pasted payloads into the editor. Matches highlight live in alternating colors with their index on hover.

  3. 03

    Inspect groups

    The summary shows match count and scan time; the table breaks every match into full text, numbered groups, and named groups.

  4. 04

    Export runnable code

    Copy the same logic as JavaScript matchAll, Python re.finditer, or PHP preg_match_all and paste it straight into your project.

Reference

Common Regular Expression Flags Explained (g, i, m, s, u)

Flags change what the same pattern means. Global finds every occurrence, case-insensitive forgives casing, multiline re-anchors per line, dotAll lets dots span newlines, and unicode fixes character counting beyond ASCII.

Flag Name What it does
g Global Find all matches, not just the first. The preview always scans globally.
i Case-Insensitive Match upper and lower case alike — handy for emails and URLs.
m Multiline Makes ^ and $ anchor per line, so validators test every row.
s DotAll Lets . match line breaks for multi-line blocks and payloads.
u Unicode Correct code-point handling for emoji and international text.

Safety

Best Practices for Writing Safe and Efficient Regex Patterns (Avoiding ReDoS)

ReDoS — catastrophic backtracking — turns one crafted input into a hung server. These three habits keep patterns linear-time, and the guard on this page enforces the same budgets you should enforce in production.

01

Prefer precise character classes

A narrow class like [0-9]{4}-[0-9]{2} backtracks far less than .* with lookarounds. Say exactly what you accept and the engine does less guessing.

02

Never nest unbounded quantifiers

(a+)+ or (x|x y)* on overlapping input causes catastrophic backtracking. Flatten the group or add an atomic boundary to kill the ambiguity.

03

Anchor and bound repetitions

^...$ plus explicit limits ({1,64} instead of +) shrink the search space dramatically — the 150 ms guard on this page rarely trips on anchored patterns.

FAQ

Frequently Asked Questions

Is my pattern or test data sent to any server?

No. Matching, highlighting, timing, and code generation all run locally in your browser tab with the built-in JavaScript RegExp engine — the network tab stays completely silent. Your last pattern, flags, and test string are remembered only in your own browser localStorage under the key regex:state so you can resume after a reload.

Can a bad pattern freeze my browser tab?

This page guards against that: test input is capped at 20,000 characters, scanning stops after 500 matches or a 150 ms time budget, and only the first 50 matches render in the table. If a pattern hits a guard you get a warning instead of a hang — simplify nested quantifiers like (a+)+ to recover instantly.

Will a pattern tested here behave the same in my code?

Yes for JavaScript — this tool uses your browser native RegExp engine, the exact engine Node.js and frontend code run. The Python and PHP snippets translate the same logic to re.finditer and preg_match_all, but re-test edge cases (Unicode classes, lookbehind) in those runtimes before shipping.