Regex Tester - JavaScript Regular Expressions, Live
Test a JavaScript regular expression against sample text and see every match highlighted live, along with each match's capture groups.
Maintained by Hirantha Sandaruwan Lakshan. Updated 31 July 2026.
How it works
The pattern and flags you enter are compiled into a real JavaScript RegExp object and run against your test text using the same engine your browser uses everywhere else.
With the global flag enabled, every match in the text is found and highlighted, not just the first - matching how most real-world regex usage in code actually runs.
Each match's numbered capture groups are listed separately below the highlighted text, useful for confirming a pattern extracts the right pieces before using it in code.
Worked examples
Testing a validation pattern before using it in code
Paste a pattern for validating an email or phone number format against several example inputs to confirm it matches what it should and rejects what it shouldn't.
Extracting data with capture groups
Write a pattern with parenthesised groups to pull specific pieces, like a date's year and month, out of a larger string.
Debugging why a pattern isn't matching
Adjust the pattern and flags live against the same test text to see exactly which change fixes the match.
Frequently asked questions
Is my pattern or test text uploaded anywhere?
No, matching runs entirely in your browser tab using the native RegExp engine.
Which flags are supported?
The common ones: g (global), i (case-insensitive), m (multiline), and s (dot matches newline).
What happens if my pattern is invalid?
The JavaScript engine's own syntax error is shown directly, the same message you'd see in a browser console.
Does this match the same regex flavour used in Python or PCRE?
No - this uses JavaScript's regex engine specifically, which differs in some details from Python's `re` module or PCRE.
Does it show capture groups?
Yes, each match is broken out with its groups, which is usually the fastest way to see why a pattern isn't extracting what you expected.
Why does my pattern match more than I expect?
Almost always greedy quantifiers. .* takes as much as it can; adding a question mark to make it .*? makes it take as little as possible.
How do I match across multiple lines?
The m flag makes ^ and $ match at each line break, and the s flag makes . match newline characters too. They solve different problems and are often needed together.
Can a regex hang the page?
Certain patterns with nested quantifiers can backtrack catastrophically on the wrong input. If typing a pattern makes things freeze, that's what happened - simplify the nesting.
Sources & references
Updated Jul 31, 2026