Regex Tester & Debugger
Perfect for developers, data analysts, and anyone working with text patterns.
Regular Expression
Test String
Replacement
Match Results
Match Details
Total Matches
Groups Found
Execution Time
Replacement Result
Regex Reference
Test and debug regular expressions with live highlighting. Type a pattern and test text, click Run Regex to see every match and capture group, try a replacement, and use Explain Pattern to understand what an unfamiliar regex does. It uses JavaScript’s regex engine, the same one as your browser and Node.js.
How to test a regex
- Enter your pattern in Regex Pattern (without the surrounding slashes), or click Load Example.
- Paste the text to test and click Run Regex. Matches are highlighted and listed with their groups in Match Details.
- Optionally add a replacement (use
$1,$2for groups) and click Apply Replacement. Save Pattern keeps a regex for next time.

10 common regex patterns (tested)
| Matches | Pattern | Example that matches |
|---|---|---|
| Email address | ^[\w.+-]+@[\w-]+(\.[\w-]+)+$ | asha.rao+news@example.co.in |
| Indian mobile number | ^(\+91[\s-]?)?[6-9]\d{9}$ | 9876543210, +91 9876543210 |
| Indian PIN code | ^[1-9]\d{5}$ | 110001 |
| URL (http or https) | ^https?:\/\/[\w.-]+(\.[a-z]{2,})(\/\S*)?$ | https://freetoolsland.com/word-counter/ |
| Date DD/MM/YYYY | ^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$ | 05/11/2026 |
| Time 24-hour HH:MM | ^([01]\d|2[0-3]):[0-5]\d$ | 09:30, 23:59 |
| Hex colour | ^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ | #1f7a4d, #fff |
| PAN card format | ^[A-Z]{5}\d{4}[A-Z]$ | ABCDE1234F |
| Whole number | ^-?\d+$ | 42, -7 |
| Strong password (8+, upper, lower, digit, symbol) | ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$ | Tr0ub4dor! |

Regex cheat sheet
| Token | Meaning |
|---|---|
. | Any character except a line break |
\d \w \s | Digit, word character (letter, digit, _), whitespace |
\D \W \S | Not a digit, not a word character, not whitespace |
[abc] [^abc] [a-z] | One of, none of, a range |
* + ? | 0 or more, 1 or more, 0 or 1 |
{3} {2,5} {2,} | Exactly 3, between 2 and 5, 2 or more |
*? +? | Lazy: match as little as possible |
^ $ \b | Start, end, word boundary |
(…) (?:…) (?<name>…) | Capturing, non-capturing and named groups |
a|b | a or b |
(?=…) (?!…) | Followed by, not followed by (lookahead) |
Flags g i m s u | Global, ignore case, multiline ^ and $, dot matches newlines, Unicode |
Frequently asked questions
Why does my regex match too much?
.* is greedy and grabs as much as it can. Make it lazy with .*?, or be more specific, for example [^"]* to stop at the next quote.
Will a pattern that works here work in Python or PHP?
Usually, because the basic syntax is shared. Differences appear in advanced features such as lookbehind, named groups and Unicode classes, so test again in your language if you use them.
Looking for something else? Browse all our free text and developer tools.
Sources
Checked in November 2026:
How to cite this tool
Using this tool for coursework, a report or research? You can cite it like this (APA 7th edition):
Kumar, M. (2026). Regex Tester & Debugger Online [Online tool]. FreeToolsLand. https://freetoolsland.com/regex-tester-and-debugger/
Related developer tools
- JSON Formatter: validate the data your regex extracts.
- Text Compare: check text before and after a replacement.