Live preview
Type a pattern above
Cheat sheet
\d \w \s — digit · word char · whitespace
. * + ? {n,m} — any char · 0+ · 1+ · optional · quantifier range
^ $ \b — start · end · word boundary
[abc] [a-z] — character classes
(...) (?:...) (?<name>...) — group · non-capturing · named group
a|b (?=x) (?!x) — alternation · lookahead · negative lookahead
How it works
Regex Tester highlights matches in your text as you type a regular expression and shows capture groups. A built-in cheat sheet makes it handy for learning too. It's useful for validating patterns, cleaning data and searching through code.
Quick start
- Enter a regular expression and choose your flags.
- Paste test text and watch the matches highlight.
- Check the capture groups and refine the expression.
Frequently asked questions
What are capture groups?
Parts of the pattern in parentheses that pull out a piece of the match, such as the day, month and year from a date.
What do flags do?
For example, g finds all matches, and i ignores the difference between upper and lower case.
Will it behave like my programming language?
It uses the JavaScript regex engine, so small differences from other languages can appear.