Regular Expression Tester
Test and analyze JavaScript Regular Expressions in real-time. Instantly visualize matches and capturing groups.
About the Regex Tester
Type a regular expression and some test text to see every match highlighted, with the global, case-insensitive and multiline flags you choose.
Everything you enter is processed in your browser; nothing is uploaded or stored.
How to use it
- Enter your pattern in Regular Expression (without the surrounding slashes).
- Tick the flags you need: g (all matches), i (ignore case), m (multiline).
- Paste test text and read the matches in Match Results.
How the regex tester evaluates patterns
The pattern is compiled with JavaScript’s RegExp engine using the flags you ticked, and run against the test string. With g it reports every match; without it, only the first. An invalid pattern shows the engine’s error message.
Because it is the JavaScript engine, the results match what your browser or Node.js code will do. Other languages (PCRE, Python, Java) share most syntax but differ in features such as lookbehind support and named-group syntax.
Example
The pattern \b\d{6}\b with the g flag finds every six-digit Indian PIN code in a block of addresses.
Tips
- Escape special characters with a backslash: \. matches a literal dot, . matches any character.
- Use the m flag when ^ and $ should match at the start and end of each line rather than the whole text.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript), the same as browsers and Node.js.
Why does my pattern only find one match?
Turn on the g (global) flag to find all matches.
How do I match an email address?
A practical pattern is [\w.+-]+@[\w-]+\.[\w.]+ – it catches normal addresses; full RFC validation needs a far longer pattern.