Regex Tester
See exactly what your regular expression matches, as you type, with the groups and a replace preview.
Works in your browser. Nothing you type is sent to us.
Cheat sheet
Tested in your browser with its own regular expression engine, the one JavaScript uses. Nothing you type is sent to us.
Regex Tester at a glance
- Price
- Free
- Data sent to us
- None, it runs in your browser
- Sign-up
- Not needed
- Engine
- The browser's JavaScript engine
- Flags
- g, i, m, s, u
- Limit
- 2,000 matches shown per run
How to use Regex Tester
- Type the patternEnter it without the surrounding slashes and tick the flags you need. An error under the box means the pattern does not compile yet.
- Paste the textMatches light up as you type; the list on the right shows each one with its groups.
- Try a replacementType into Replace with to see the text with the matches replaced, then copy the matches or the result.
Type a pattern and paste the text to test it on: every match is highlighted in place as you type, with its captured groups, named groups and position listed beside it, and a pattern that will not compile says why. Switch the g, i, m, s and u flags with one click, type a replacement to see the text with the matches swapped out, copy the matches or the result, and click an entry in the cheat sheet to add it to the pattern. The engine is the JavaScript engine in your browser.
How it works
Regex Tester is a web page that does its work on your own device. Everything you type or choose is worked out by your browser and never sent to a server, so nothing is stored and there is nothing to delete. There is no account, no sign-up and no limit on how often you use it.
Straight to one job
Testing a pattern as you type
A regular expression is a small language for describing text, and nobody gets one right first time. This tester runs your pattern against your own text on every keystroke and paints the matches in place, alternating two colours so neighbouring matches stay distinct, with the groups each match captured listed beside it. A pattern that will not compile says why, in the engine's own words, instead of silently matching nothing. The engine is the one built into your browser, the same JavaScript engine your code will use, so what matches here matches there.
Flags
g finds every match rather than the first. i ignores letter case. m makes ^ and $ match at the start and end of each line instead of the whole text. s lets the dot match line breaks. u switches on full Unicode, which you need for \p{L} and for emoji to count as one character. The replacement box shows the text with every match replaced, using $1, $2 or $<name> for the groups, which is the quickest way to prototype a find-and-replace or a cleanup script.
Dialects
JavaScript, Python, PCRE, Java, .NET and Go share most of the language: character classes, quantifiers, groups, lookahead and backreferences work the same. They differ at the edges: named groups are written (?<name>) here and (?P<name>) in Python, possessive quantifiers and atomic groups exist in PCRE and Java but not here, and \p{...} classes need the u flag. A pattern tested here will almost always run elsewhere; check the cheat sheet for the forms this engine expects.
What this tool does not do
- It does not run patterns against files; paste the text. Matches are capped at two thousand so a runaway pattern cannot freeze the page.
- It does not explain a pattern in English or generate one from examples; it shows what a pattern does, which is usually the faster way to learn it.
What it does
- Matches highlighted in the text as you type, alternating colours
- Capture groups and named groups listed for every match, with positions
- Flags g, i, m, s and u with one click; compile errors explained
- Replace preview with $1, $2 and $<name>, and copy the result
- Copy all matches, one per line
- Cheat sheet of the common forms, click to insert
- No upload, no account, no sign-up
Questions
Which regex engine does this use?
The one built into your browser, which is the JavaScript engine. Patterns tested here run the same in JavaScript, and almost always in Python, PCRE, Java, .NET and Go too; the cheat sheet notes the few forms that differ.
Why does my pattern match nothing?
Check the flags first: without g only the first match is found, without i case must match exactly, and ^ and $ match only at the ends of the whole text unless m is on. Then check for characters that need escaping, such as a dot or a bracket, and look at the error line under the pattern.
How do I use capture groups?
Wrap part of the pattern in parentheses, (…), and it is listed as $1, $2 and so on under each match. Name a group with (?<name>…) and it is listed by name. In the replacement box, $1 or $<name> inserts what the group matched.
What are the flags?
g finds every match instead of the first; i ignores case; m makes ^ and $ work per line; s lets . match line breaks; u turns on full Unicode so \p{L} and emoji work.
Can I test a replacement?
Yes. Type the replacement text and the result appears below it, with $1, $2, $<name> and $& for the groups and the whole match. Copy result puts it on your clipboard.
Why are there two colours?
Neighbouring matches alternate so you can see where one ends and the next begins, which a single colour hides when matches touch.
Is my text sent anywhere?
No. Everything runs in your browser and nothing is stored.
Is it free?
Yes, completely free, with no sign-up.


