About the Regex Tester
Type a regular expression and a test string and see every match highlighted as you type. The tool uses JavaScript's own RegExp engine, so what matches here matches in your browser code and in Node.js. It lists each match with its position and capture groups, including named groups.
How to use it
- Enter your pattern in the Pattern field, without the surrounding slashes.
- Switch flags on or off: g (global), i (case-insensitive), m (multiline) and s (dotAll).
- Paste or type text into Test String and watch the matches highlight.
- Open Match Details to see each match, its index and its capture groups.
Features
- Live highlighting of every match
- Flags g, i, m and s, toggled with one click
- Capture groups and named groups listed per match
- Immediate error message when the pattern is not a valid regular expression
- Uses the JavaScript RegExp engine, so results match your JS and Node code
Frequently asked questions
- Which regex flavour does this use?
- JavaScript (ECMAScript). Syntax such as lookbehind and named groups follows what your browser supports, and some features from PCRE, Python or .NET may behave differently or be unavailable.
- What do the flags do?
- g finds all matches instead of the first, i ignores case, m makes ^ and $ match at line breaks, and s lets the dot match newline characters.
- Why does my pattern match nothing?
- Common causes are a missing g flag when you expect several matches, an unescaped special character such as . or ( , or anchors ^ and $ without the m flag on multi-line text.
Part of Octodius' free developer tools. Everything here runs in your browser.