Regular expression
/
/
Test string
Match highlighting
Your text with matches highlighted will appear here…
Capture groups
No capture groups found
Replace
Replace output appears here…
What is a Regex Tester?
A regex tester lets you write and test regular expressions against sample text in real time. Regular expressions (regex) are patterns used to match character combinations in strings — used in form validation, text search and replace, data extraction, and parsing.
This tester highlights all matches in your test string, shows capture group values, and lets you test string replacement with your pattern. All processing happens in your browser — no data is transmitted.
Frequently asked questions
What are regex flags?
Flags modify how a pattern matches. g (global) finds all matches. i (case insensitive) ignores case. m (multiline) makes ^ and $ match line boundaries. s (dotall) makes . match newlines too.
What are capture groups?
Capture groups are parts of a pattern wrapped in parentheses (). They capture the matched text for use in replacements ($1, $2) or to extract specific parts of a match.
What does the . (dot) match?
By default, . matches any character except newlines. With the s (dotall) flag enabled, it matches newlines too.
How do I match a literal dot or special character?
Escape it with a backslash. \. matches a literal dot. \( matches a literal opening parenthesis. \\ matches a literal backslash.
Quick reference
.Any character
\dDigit [0-9]
\wWord char [a-zA-Z0-9_]
\sWhitespace
^Start of string
$End of string
*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
[abc]Character class
(abc)Capture group
a|ba or b
(?:)Non-capture group
Related tools