Regex Tester
Find the pattern. See the match. Test regular expressions in real time, with capture groups and replacement previews.
| # | Match | Index | Length |
|---|
Use $& for the match, $1 for a group, or $<name> for a named group.
Replacement previewNo signup. Your pattern and text stay in this browser.
How to use
the regex tester
- Write your expression.Enter the pattern without opening and closing slashes, or choose an example.
- Add your test string.Paste the text you want to search. Matches are highlighted as you type.
- Fine-tune and inspect.Adjust the flags, check capture groups, then try a replacement or export your matches.
Regex quick reference
| Pattern | What it does |
|---|---|
. | Any character except line breaks (or any character with s) |
\d · \w · \s | Digit · word character · whitespace |
[a-z] · [^a-z] | One character in the range · one outside it |
* · + · ? | Zero or more · one or more · zero or one |
{n,m} | Repeat between n and m times |
^ · $ | Start · end of input (or line with m) |
(…) · (?:…) | Capturing group · non-capturing group |
a|b | Match a or b |
\b | A word boundary |
(?<name>…) | A named capturing group |
What is a regular expression?
A regular expression, or regex, describes a pattern in text. It can find words, extract values, check a format or replace matching text. For example, \d+ finds one or more digits; parentheses let you capture smaller parts of a match.
What do the regex flags mean?
g finds all matches rather than stopping at the first. i ignores case. m lets ^ and $ match line boundaries. s lets the dot match line breaks. u enables Unicode-aware matching. y requires a match at the current search position; with g, matching continues only while matches are consecutive.
Why doesn’t my expression match?
Check capitalization, whitespace and escaped characters first. A literal dot needs \., because a plain dot is a wildcard. Use g to find more than one match, and check whether ^ or $ is restricting the match to the entire input. If the expression itself is invalid, the tester shows the browser’s error.
Does this test Python, PCRE, PHP or .NET regex?
This tool uses your browser’s JavaScript RegExp engine. Many expressions are similar across languages, but syntax and behavior can differ. Check the expression in its target language before using it there.
Is my test text uploaded or saved?
No. Patterns, test strings and replacements are processed locally in your browser. The tester doesn’t upload or save them. If you export matches, a JSON file is downloaded to your device.
What are the limits?
You can test up to 100,000 characters with a pattern up to 4,000 characters long. The tester highlights and exports up to 1,000 matches, and the details table shows the first 100. Expressions that take too long are stopped so you can keep editing.
Learn more in the JavaScript regular expressions guide.