Regex tester
Write a pattern, paste some text, and every match lights up as you type, with the captured groups listed below.
//
Matches
Patterns developers use every day
| Matches | Pattern |
|---|---|
Email address (practical) | [\w.+-]+@[\w-]+\.[\w.-]+ |
URL | https?:\/\/[^\s]+ |
IPv4 address | \b(?:\d{1,3}\.){3}\d{1,3}\b |
Date (YYYY-MM-DD) | \d{4}-\d{2}-\d{2} |
Time (HH:MM, 24h) | ([01]\d|2[0-3]):[0-5]\d |
Hex color | #(?:[0-9a-fA-F]{3}){1,2}\b |
UUID | [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} |
URL slug | ^[a-z0-9]+(?:-[a-z0-9]+)*$ |
Phone, international (E.164) | ^\+[1-9]\d{7,14}$ |
Only digits | ^\d+$ |
Leading and trailing spaces | ^\s+|\s+$ |
How it works
- JavaScript flavorPatterns run with the JavaScript engine in your browser, the same one Node.js uses.
- Flagsg finds every match, i ignores case, m makes ^ and $ work per line, s lets . match new lines, u enables full Unicode.
- GroupsParentheses capture parts of a match. They are listed as $1, $2 and so on.
Questions
Why does my pattern work here but not in Python?
Regex flavors differ a little. Lookbehind, named groups and some escapes are written differently in Python, PCRE and JavaScript.
Is my text sent anywhere?
No. Matching happens in your browser.
More tools
Built something with it?
Show it in the server, get a code review, or ask the people who use these tools every day.
online now · members