Regex Tester
Live matches, highlighted in context, with capture groups
3 matches
Contact: ada@example.com and grace@navy.mil Backup: alan@bletchley.uk Not an email: hello world
ada@example.comIndex 9$1: ada $2: example.com
grace@navy.milIndex 29$1: grace $2: navy.mil
alan@bletchley.ukIndex 52$1: alan $2: bletchley.uk
Everything runs in your browser. Your data never leaves your device.
Related tools
How to use
The tester uses the browser's own RegExp engine, so behaviour matches exactly what your JavaScript will do at runtime. There is no dialect difference between what you test here and what you ship.
Write your pattern
Enter the pattern without the surrounding slashes — they are shown around the field for orientation. Invalid patterns report the engine's own error message.
Toggle flags
Global finds every match rather than only the first, which is usually what you want while testing. Each flag has a description available to screen readers and on inspection.
Read the highlights
Matches are highlighted directly in the test string, so you can see overlapping intent and unintended matches in context rather than as a detached list.
Inspect capture groups
Each match lists its numbered groups as $1, $2 and so on, plus any named groups. This is the fastest way to confirm your groups capture what you expect before writing replacement code.
Examples
Extracting email parts
The pattern (\w+)@(\w+\.\w+) with the global flag matches ada@example.com and captures "ada" as $1 and "example.com" as $2, letting you confirm the split before using it in code.
Why the global flag changes everything
Without g, only the first match is returned no matter how many exist. This catches people out constantly when a pattern works in a tester but processes only one item in production.
About this tool
Test JavaScript regular expressions against sample text with matches highlighted in place. Every match is listed with its index and captured groups, including named groups. Flags are toggled individually with an explanation of what each one does, so the behaviour is visible rather than memorised.