Skip to content

Regex Tester

Test regular expressions in real time with match highlighting and capture group display. Free online regex debugger, runs 100% in your browser.

Flags
Mode
Preview
Results
Enter a regex pattern above.
Quick regex reference
PatternDescription
.Any character (except newline)
^Start of string / line
$End of string / line
*0 or more repetitions
+1 or more repetitions
?0 or 1 (optional)
{n}Exactly n repetitions
{n,m}Between n and m repetitions
\dDigit [0-9]
\DNon-digit
\wWord character [a-zA-Z0-9_]
\WNon-word character
\sWhitespace
\SNon-whitespace
\bWord boundary
[abc]Class: a, b, or c
[^abc]Negation: not a, b, or c
(abc)Capturing group
(?:abc)Non-capturing group
(?<n>abc)Named group "n"
a|bAlternative: a or b

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used across virtually every programming language and tool — from form validation in JavaScript to log parsing in Python to search-and-replace in text editors. A pattern combines literal characters, metacharacters (. ^ $ * + ? { } [ ] | ( )), and character classes (\d digit, \w word char, \s whitespace). This tool uses the ECMAScript regex engine (the same one used in JavaScript, TypeScript, and Node.js).

Regex flags explained

gglobal: find all matches, not just the first. Essential for counting occurrences or replacing every instance.
iignore case: match uppercase and lowercase letters interchangeably. /hello/i matches "Hello", "HELLO", and "hello".
mmultiline: ^ and $ match the start and end of each line, not just the whole string. Critical for line-by-line log parsing.
sdotAll: the . metacharacter matches newline characters too. Without this flag, . stops at line breaks.

Capturing groups

Capturing groups (pattern) capture the matched substring for extraction or backreference. Named groups (?<name>pattern) assign a readable name to the capture, accessible via match.groups.name — much clearer than numbered groups in complex patterns. Non-capturing groups (?:pattern) group without capturing — useful for applying quantifiers to a sequence without creating an unnecessary capture. Backreferences like $1, $2 in replacement strings refer to the captured text by group number.

Privacy

All matching runs 100% in your browser. No data is sent to a server.