Regex Tester
Test JavaScript regular expressions as you type, see the matches and their groups, replace and read what each part means
Test text
Matches in the text
Matches
No match.
Replace
$1 or $<name> for a group, $& for the whole match
Result
Explanation
The expression a part at a time
(?<year>a group named "year", of:
\da digit (0–9)
{4}the part before exactly 4 times
)the end of the group
-the character "-"
(?<month>a group named "month", of:
0the character "0"
[1-9]one character of 1-9
|or
1the character "1"
[0-2]one character of 0-2
)the end of the group
-the character "-"
(?<day>a group named "day", of:
0the character "0"
[1-9]one character of 1-9
|or
[12]one character of 12
\da digit (0–9)
|or
3the character "3"
[01]one character of 01
)the end of the group
How to test a regular expression
- Type your regular expression and its flags (g, i, m, s, u, y), or pick a common pattern: an email, a URL, a date and more.
- Type or paste the text to test it on.
- See the matches highlighted and listed, with their positions and groups.
- Try a replacement with $1, $<name> or $&, and read what each part of the expression means.
Questions
Which regex flavor does it use?
JavaScript's, as used by browsers and Node.js, with named groups, lookbehind and Unicode.
Can a bad expression freeze the page?
No, it runs separately and is stopped after a moment, so an expression that backtracks forever, such as (a+)+$, can't hang your browser.
How do I learn what my regex does?
It's explained a part at a time below the matches, in plain words.
Is my text uploaded?
No, it's tested in your browser.