Regex Tester
Test your regular expressions with sample text.
About Regex Tester
Test a regular expression against sample text and see every match highlighted, with its position and capture groups. It uses the JavaScript regular-expression engine of your browser.
When you would use it
- Building and refining a pattern before pasting it into code, a validation rule or a log-search query.
- Debugging why a pattern matches too much or too little by seeing each match and capture group.
- Learning regex syntax interactively with immediate feedback.
How to use it
- Type the pattern (without the surrounding slashes) in the regex field.
- Tick the flags you need: global, ignore case, multiline, dot-all, unicode or unicode sets.
- Enter or paste the text to match; the matches and their groups are listed below.
Things worth knowing
- This is the JavaScript flavour. Syntax such as named groups is (?<name>...), not (?P<name>...) as in Python, and features like possessive quantifiers or atomic groups are not available. Check how your target language differs before reusing a pattern.
- Without the global flag only the first match is returned. Multiline makes ^ and $ match at each line, and dot-all lets . match newlines.
- Unicode (u) and unicode sets (v) are alternatives; when both are ticked, u is used. Use one of them for patterns with emoji or \p{...} property escapes.
- An invalid pattern simply shows no matches. A pattern with nested quantifiers such as (a+)+ can take exponential time on some inputs and freeze the tab.
Frequently asked questions
- Why does my pattern work here but not in another language?
- Regex engines differ. Lookbehind, named groups, flags and Unicode handling vary between JavaScript, Python, PCRE, Java and others. Test with the engine your code actually runs on.
- Why do I only see one match?
- The global (g) flag is off. Turn it on to find all matches instead of stopping at the first one.