Regex Tester
Test and debug regular expressions with real-time highlighting and match counting.
Regex quick reference
. any char · \d digit · \w word char · * 0+ · + 1+ · ? optional · ^ start · $ end · [abc] char class · () group · | or
Practical regex examples
Invoice IDs: invoice-(\d+) matches IDs such as invoice-1042 and captures the number.
Log levels: \b(ERROR|WARN|INFO)\b highlights common log labels without matching words that merely contain those letters.
Simple email checks: ^[^@\s]+@[^@\s]+\.[^@\s]+$ is useful for rough UI validation, but production email validation needs broader rules.
Testing tips
Start with a small test string, confirm the first match, then add flags and groups. Use the g flag to find all matches. Remove it when you only want to inspect the first match and capture groups.
FAQ
Which regex flavor does this tester use?
It uses JavaScript regular expressions in your browser, so syntax and supported features match the current browser engine.
Why are zero-length matches skipped?
A global regex that matches an empty string can loop forever. The tester advances past empty matches to keep the page responsive.
How do I test capture groups?
Wrap the part you want to capture in parentheses, then test against a small sample first before expanding the pattern.
What do the g, i, and m flags do?
g finds all matches, i ignores case, and m makes ^ and $ work against line starts and line ends instead of only the whole string.