Regex Tester
Test 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.
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.
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
Base64 Encode / Decode
Encode text to Base64 or decode it back.
Color Converter (HEX ↔ RGB)
Convert HEX to RGB and back, with live preview.
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.
URL Encoder / Decoder
Encode or decode URLs and query strings.