Regex Tester

Test regular expressions in real-time with match highlighting, capture groups, and flag support. Includes a handy cheat sheet — everything runs in your browser.

Test your regex

Enter a pattern and test string. Matches highlight in real-time.

Match Details

Common Regex Patterns Cheat Sheet
.Any character (except newline)
\dDigit [0-9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word character
\sWhitespace
\SNon-whitespace
^Start of string/line
$End of string/line
\bWord boundary
*0 or more
+1 or more
?0 or 1 (optional)
{n,m}Between n and m times
[abc]Character class
[^abc]Negated class
(abc)Capture group
(?:abc)Non-capturing group
a|bAlternation (or)
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

What is a regular expression?

A regular expression (regex) is a pattern that describes a set of strings. Regex is used in programming, text editors, and command-line tools for searching, matching, and replacing text. Common use cases include validating email addresses, extracting data from logs, and performing find-and-replace operations across codebases.

Flags explained

The g (global) flag finds all matches instead of stopping at the first. The i flag makes the pattern case-insensitive. The m (multiline) flag makes ^ and $ match the start and end of each line. The s (dotAll) flag makes . match newline characters too.

Capture groups

Parentheses () create capture groups that extract specific parts of a match. This tool shows each group's value in the match details, making it easy to debug complex patterns. All testing runs in your browser — your data stays private.

More developer tools