Regex Visualizer & Tester

Visual debugging, ReDoS detection, and multi-language code generation

Common Patterns

Regular Expression

/ /

Test String

0 matches 0ms
Ln 1, Col 1
0 characters

Highlighted Matches

Results will appear here...

Recent Regex Tests

Stored only in this browser.

See what your regular expression does

Enter a pattern and a test string to highlight matches and inspect captured groups. The Visualizer tab draws a railroad diagram, the Explainer tab describes the pattern part by part, and the Code Generator produces snippets for JavaScript, Python, Go, PHP, Java and Rust.

Reading a railroad diagram

Follow the line from left to right. Boxes are things that must be matched. A branch means any one of the paths can be taken, a path that skips a box means it is optional, and a loop means it can repeat.

Flags

g finds all matches, i ignores case, m makes ^ and $ match at each line, and s lets the dot match line breaks.

Avoiding slow patterns

Nested repetition such as (a+)+ can take exponential time on some inputs in backtracking engines. This is called ReDoS. The checker warns about risky structures, but a clean result is not proof of safety, so limit input length for untrusted text.

Frequently asked questions

What is a regex visualizer?

It draws the structure of a regular expression as a diagram, so you can see alternatives, optional parts and repetition.

Do regular expressions work the same in every language?

No. Basic syntax is shared, but features such as lookbehind, named groups and flags differ between engines. Test the pattern in your target language.

What is ReDoS?

Regular expression denial of service happens when a crafted input makes a backtracking pattern run for a very long time.

Related tools