About this tool
Tests JavaScript regular expressions with live match highlighting and capture groups. Useful for building and debugging regex without an interpreter, validating patterns before pasting them into code, figuring out why a regex that should work isn't matching what you expect, and learning by experimentation.
How to use
- Write your regex pattern.
- Set the flags (g for all occurrences, i for case insensitive, m for multiline, etc.).
- Paste the text to test.
- See matches highlighted in the text and capture groups listed.
Frequently asked questions
- Which regex flavor is used?
- JavaScript (ECMAScript). Most patterns also work in other languages (Python, Ruby, PCRE), but there are differences in more advanced syntax: lookbehind, named groups, Unicode properties. For regex you'll use in another language, check the specific differences.
- What are capture groups?
- Parts of the regex inside parentheses that capture what they match, for reuse. For example, the pattern (\w+)@(\w+) applied to "ana@mail.com" captures "ana" in group 1 and "mail" in group 2. Useful for extracting specific parts of a text.
- What are the g, i, m, and s flags for?
- g (global) makes the regex match all occurrences, not just the first. i (case insensitive) ignores upper/lower case. m (multiline) makes ^ and $ match the start and end of each line instead of just the whole text. s (dotall) makes the dot . also match newlines.