Regex Tester
Test, check and validate regular expressions with live highlighting.
Regular expressions are the power tool for searching and validating text — emails, phone numbers, log parsing.
How to use
- Type your pattern — it is tested as you type.
- Toggle g / i / m flags as needed.
- Matches highlight yellow in your test text.
About this tool
This tester uses JavaScript regex syntax, the same flavor that runs in browsers and Node.js.
Your pattern and test text never leave your browser.
Form keeps rejecting your input? Paste the value as test text and use this as a regex checker: if the pattern highlights it, the string validates — and the match count shows exactly what matched.
How it works
A regular expression is a pattern in a compact notation: literal characters match themselves, . matches any character, \d a digit, \w a word character, \s whitespace. Quantifiers control repetition — * (zero or more), + (one or more), ? (zero or one), {2,4} (between 2 and 4).
Anchors ^ and $ pin the match to the start and end of the string. Without them, \d+ matches 'abc123' because it finds digits anywhere; ^\d+$ only matches strings that are entirely digits.
Parentheses ( ) group parts of the pattern and capture them for reuse, | means 'or', [abc] matches one listed character, [^abc] matches anything except those, and [a-z] matches a range.
Worked examples
Validating an email field: Test ^[^\s@]+@[^\s@]+\.[^\s@]+$ against input as the user types — 'not an email' is rejected instantly, before the form is ever submitted.
Pulling dates out of text: Run (\d{4})-(\d{2})-(\d{2}) over 'shipped 2024-03-15' to capture year, month, and day as three separate groups.
Quick reference
| Pattern | Matches |
|---|---|
| ^\d+$ | A string that is only digits |
| ^[^\s@]+@[^\s@]+\.[^\s@]+$ | A basic email address |
| ^\+?[\d\s-]{7,}$ | A phone number |
| ^\d{4}-\d{2}-\d{2}$ | A date like 2024-03-15 |
| ^https?:// | An http:// or https:// URL |
| \b\w+\b | Each word in the text |
Frequently asked questions
Which regex flavor is this?
JavaScript (ECMAScript) — very close to Python and Java for common patterns.
Why is my pattern invalid?
Unescaped special characters like ( [ + are the usual suspects — the error message says which.
Is my test data uploaded?
No — 100% local.
How do I check if a string matches my pattern?
Paste the string as the test text. Matches highlight as you type and the counter shows how many were found — no highlight means no match.
First time embedding? Read the step-by-step guide →
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
JSON Formatter & Validator
Format, minify and validate JSON in one click.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
JWT Decoder
Decode a JWT token without the secret — see its header and payload.
SHA-256 Hash Generator
Generate SHA-256 / SHA-512 hashes instantly.
ASCII Table Reference
Look up ASCII codes: char, decimal, hex.