Regex Tester
Test regular expressions against sample text and see every match highlighted.
How it works
Regular expressions are powerful but notoriously hard to get right on the first try -- a pattern that looks correct can silently match too much, too little, or nothing at all. This tester runs your pattern against real sample text using JavaScript's native regex engine (the same one in Node.js and every browser), so what works here works identically in your actual code.
Every match is listed with its exact position in the string and any captured groups, so you can immediately see whether your pattern is behaving as intended -- including edge cases like overlapping or zero-length matches.
Supports all standard JavaScript regex flags (g, i, m, s, u, y). Nothing you enter is sent anywhere; matching happens instantly in your browser as you type.
Frequently asked questions
Which regex flavor does this use?
This uses JavaScript's native RegExp engine, the same one used in Node.js and browsers -- so patterns tested here behave identically when used in actual JS/TS code.
What do the flags (g, i, m, s) mean?
g = global (find all matches, not just the first), i = case-insensitive, m = multiline (^ and $ match line boundaries), s = dotall (. matches newlines too).
Why does my pattern match zero times when I expect matches?
Common causes: forgetting to escape special characters (. * + ? need \\ before them to match literally), or an anchor (^ or $) that doesn't align with where you expect it to given your flags.
What are capture groups used for?
Parentheses in a pattern create a capture group, letting you extract a specific sub-part of each match -- shown separately in the results here so you can verify your groups are capturing what you intend.