Type a pattern and some text: every match lights up as you type, with its groups, and each part of the pattern is explained in plain English. It uses your browser’s own JavaScript regex engine.
This is how the page reads the pattern ^\d{3}-[A-Z]+$, part by part:
| Part | Means |
|---|---|
^ | the start of the text |
\d | a digit (0-9) |
{3} | …exactly 3 times, as many as possible |
- | the character "-" |
[A-Z] | one character from: A to Z |
+ | …one or more times, as many as possible |
$ | the end of the text |
Flags change how the whole pattern works. Turn them on and off with the letters after the pattern:
| Flag | Does |
|---|---|
g | global: find every match, not just the first |
i | ignore case |
m | multiline: ^ and $ match at each line |
s | dotAll: . matches line breaks too |
u | Unicode: read the pattern as Unicode code points |
y | sticky: match only at lastIndex |
In the Replace box, $1, $2 … put back what each group matched, $<name> a named group, and $& the whole match. So with the pattern (\w+)@(\w+) and the replacement $2: $1, "ann@example" becomes "example: ann".
JavaScript’s (ECMAScript), run by your browser. Most of it is the same in Python, Java, PHP (PCRE) and .NET, but look-behind support, named groups and \p{…} differ in a few places.
Common causes: a character that needs a backslash, such as . ? + ( or ), anchors ^ and $ without the m flag on multi-line text, or case (turn on i).
Brackets ( ) around part of a pattern save what that part matched, so you can read it out or reuse it as $1 in a replacement. (?: ) groups without saving.
No. The pattern runs in your browser on your device.
Open all 35 Dev Tools. Everything runs in your browser; nothing you paste is uploaded.