Regex Tester
Test and debug regular expressions in real time, with capture groups.
What this tool does
Real-time regex tester. Write a pattern, paste your text, set the flags and see matches and capture groups update instantly. Built to help you understand what your regex actually does without opening a console.
In developer flows it pairs naturally with JSON formatter. For long passages, word counter helps you understand the scope of what you're processing.
What you can use it for
- Check whether an email or phone number matches your pattern.
- Pull specific fragments out of a string using capture groups.
- Debug a regex that's misbehaving in production.
- Learn regex by watching which parts of the text get highlighted.
How to use it
- Type the pattern in the Pattern field, without the leading and trailing slashes.
- Set the flags (g, i, m, s, u, y) in the corresponding field.
- Paste the text you want to test.
- Matches are highlighted and capture groups appear below.
Everything runs inside your browser. No file is uploaded to any server. See more tools in this field.
Regex patterns you'll keep coming back to
These patterns cover the most common validations. Copy, paste, adjust to your case. Remember to escape special characters when you need them literal.
Basic email
^[\w.+-]+@[\w-]+\.[\w.-]+$Covers 95% of real-world emails. Not full RFC, but it works in production.
International phone
^\+?[1-9]\d{6,14}$E.164 format: optional +, 7 to 15 digits, no dashes or spaces.
http(s) URL
^https?:\/\/[\w.-]+(?:\/\S*)?$Accepts http and https, domain and optional path, querystring not required.
Hex color
^#?(?:[0-9a-fA-F]{3}){1,2}$Three or six hex characters, with or without the hash.
ISO date
^\d{4}-\d{2}-\d{2}$YYYY-MM-DD format. Does not validate the date exists, only the shape.
Slug
^[a-z0-9]+(?:-[a-z0-9]+)*$Lowercase letters and digits separated by a hyphen. SEO standard.
Mistakes that cost time
The dot is not always a dot
In regex, . means any character except newline. If you need a literal dot, escape it: \.
Greedy vs lazy
.* is greedy and grabs everything it can. If you want the minimum possible, use .*? to make it lazy.
Forgetting the g flag
Without g, .match() in JavaScript returns only the first match. To find them all, add g to the flags.
Misplaced anchors
^ and $ tie the pattern to the start and end of the line. If you put them in the wrong spot, nothing matches even when the pattern is correct.
Pairs well with
Other tools people reach for in the same flow.
- JSON Formatter
format and validate JSON
Strong fit in developer workflows.
- Text CompareComing soon
Useful to validate and review text.
- Word Counter
count words and characters in your text
Useful to validate and review text.
Related tools
DeveloperJSON Formatter
Format, validate and minify JSON in your browser.
UUID Generator
Generate cryptographic UUID v4 identifiers on demand.
Base64 Encoder/Decoder
Encode and decode Base64 text, with optional URL-safe alphabet.
Slug Generator
Turn any text into a clean URL slug.
Frequently asked questions
Which regex engine does the tool use?
It uses the JavaScript engine, so the syntax follows the ECMAScript standard. If you paste a regex written for PCRE (PHP, Python) or Perl, some advanced constructs such as variable-length lookbehinds may not behave the same.
Which flags can I use?
The JavaScript standard flags: g (global), i (case insensitive), m (multiline), s (dotAll), u (unicode) and y (sticky). You can combine them freely.
What are capture groups?
Parentheses in a regex group parts of the match so you can reuse them. The tool shows each numbered group under every match so you see exactly what each one captures.
Is my text sent to a server?
No. Both the regex and the text are evaluated in your browser. Nothing leaves your machine, so you can safely test with sensitive data.
