Regex tester
Test your regex and highlight matches.
- Instant
- Free
- Private (processed locally)
- No sign-up
Build and test your regex live
Regular expressions are a powerful text-manipulation tool, but their syntax is demanding. This tester shows matches highlighted in real time as you type your pattern, so you can iterate quickly.
How to use it
-
Write your pattern
Between the two slashes, like \d+ for digits.
-
Add flags
g, i, m… depending on the behavior you want.
-
Paste the text to test
Matches are highlighted and counted.
Metacharacter cheat sheet
| Symbol | Meaning |
|---|---|
| . | Any character |
| \d / \w / \s | Digit / word char / whitespace |
| * + ? | 0+, 1+, or 0 or 1 repetition |
| {2,5} | Between 2 and 5 repetitions |
| [abc] | a, b or c |
| ^ $ | Start / end of line |
| ( ) | Capturing group |
| a|b | a or b |
Common examples
- Email:
\b\w+@\w+\.\w+\b - ZIP code (5 digits):
\b\d{5}\b - Duplicate words:
\b(\w+)\s+\1\b
Frequently asked questions
What is a regular expression?
A regex is a search pattern that describes a set of strings. It is used to find, validate or replace text according to precise rules (for example “all email addresses”).
What are flags for?
Flags change behavior: g (all matches), i (case-insensitive), m (multiline), s (dot matches newlines), u (Unicode). The tool adds g automatically to count all occurrences.
Which syntax is used?
JavaScript (ECMAScript) regular expressions, very close to PCRE for common uses. Patterns are therefore directly reusable in web code.
How do I validate an email or a number?
Enter the pattern and paste your examples: matches are highlighted live, so you can tweak the regex until it is right.
Is my text sent online?
No. The test runs in your browser; neither the pattern nor the text is transmitted.