Regex Tester
Type a regular expression (regex) and a test string — matches, position, and capture groups appear automatically as you type.
How to use the regex tester
- Type the regular expression you want to test in the pattern field.
- Add flags if needed (
gfor global,ifor case-insensitive,mfor multiline). - Type or paste your test string — all matches, their position, and any capture groups appear automatically.
What is a regular expression?
A regular expression (regex) is a pattern that describes a text structure — for example, \d+ matches one or more consecutive digits, and [a-z]+@[a-z]+\.[a-z]+ resembles a simple email address. Regex is widely used for search-and-replace, validating user input, and text processing in programming.
This tester uses your browser's built-in JavaScript regex engine, so patterns are written using standard JavaScript regex syntax.
Frequently asked questions
Why do I get an "invalid pattern" error?
The pattern doesn't follow valid regex syntax — common causes are an unbalanced parenthesis or bracket, or a flag that doesn't exist. The error message explains what went wrong.
What does the "g" flag mean?
"g" (global) makes the tester find all matches in the text, not just the first one. Without this flag the tester would only show one match even if the pattern occurs several times.
Is my text sent to a server?
No, all matching happens locally in your own browser using JavaScript's built-in regex engine.