RegexLens
Test regular expressions with live-highlighted matches.
Test text
Highlighted result
What is RegexLens?
A regular expression (regex) is a compact pattern used to find or validate pieces of text, like email addresses or phone numbers, inside a larger block of text. RegexLens lets you test a regex pattern against real sample text and see, live, exactly which parts it matches — highlighted in place — plus the contents of any capture groups, so you can check and debug a pattern before using it in code.
How to use RegexLens
- Type or paste a regex pattern into the field at the top (or click Example to load a sample), and toggle any flags (g, i, m, s, u) you need.
- Paste the text you want to test against into the Test text panel.
- Check the Highlighted result panel: every match is highlighted directly in your text, with capture groups listed below.
- Adjust the pattern or flags and watch the highlighting update live until it matches what you expect.
How regular expressions work
A regular expression (regex) describes a text pattern using a compact syntax: character classes, quantifiers and capture groups. The engine scans the test text looking for fragments that match that pattern:
Pattern: /(\w+)@(\w+\.\w+)/g Text: "Contacts: [email protected], [email protected]" Match 1: "[email protected]" group 1: "ada" group 2: "lovelace.dev" Match 2: "[email protected]" group 1: "bob" group 2: "example.com"
This tool uses JavaScript's native RegExp object with matchAll — no external libraries, no server calls.
Frequently asked questions
What regex engine does it use?
The browser's native JavaScript RegExp engine, the same one you'd use with .match() or .test() in your code — no conversion to another dialect (like PHP's PCRE or Python's).
What flags can I use?
g (global), i (case-insensitive), m (multiline), s (dot also matches newlines) and u (unicode) — toggled with checkboxes.
Does it show capture groups?
Yes, each match lists its numbered and named groups (if you use (?<name>...)) separately, with their exact text. If you want a structure diagram and plain-English explanation of the pattern itself instead of live match testing, use Regex Visualizer.
What happens if my regex has a syntax error?
It shows the exact error message the browser's engine returns, as soon as you stop typing.