🔒 Runs in your browser — nothing is uploaded✓ Free, no signup
Regex Tester — Test JavaScript Regular Expressions
Type a pattern and see every match highlighted as you type. Inspect capture groups, toggle flags and preview replacements — all in your browser.
Matches (2 found)
Contact ada@example.com or grace.hopper@navy.mil Released 2026-10-09, patched 2026-11-01 Visit https://trueformatter.com/regex-tester from 192.168.1.20 Brand colors: #7c3aed and #fff
Match details
| # | Match | Index |
|---|---|---|
| 1 | ada@example.com | 8 |
| 2 | grace.hopper@navy.mil | 27 |
When should you use the Regex Tester?
- Writing a validation pattern for emails, phone numbers or IDs
- Extracting values from logs or text with capture groups
- Checking a search-and-replace before running it on real data
How to use the Regex Tester
- 1
Enter a pattern
Type your regex in the pattern box without the surrounding slashes, or click a preset to start from a common pattern.
- 2
Pick flags
Tick g to find every match, i to ignore case, m for line-by-line ^ and $, s so . matches newlines, and u for Unicode.
- 3
Paste test text
Matches are highlighted on the right and listed with their index and capture groups below.
- 4
Try a replacement
Turn on Replace and use $1 or $<name> to rearrange matched text, then copy the result.
Examples
Named groups for dates
Pattern + text
/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g
Released 2026-10-09Groups
match: 2026-10-09 year: 2026 month: 10 day: 09
Reformat with replace
Replacement
Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3/$2/$1Result
2026-10-09 → 09/10/2026
Common errors and how to fix them
Invalid regular expression: Unterminated group- A ( has no matching ). Close the group, or escape it as \( if you meant a literal parenthesis.
Nothing to repeat- A quantifier (* + ? {n}) has nothing before it, e.g. a pattern starting with *. Escape it as \* for a literal asterisk.
Only the first match is found- Turn on the g (global) flag.
^ and $ only match the whole text- Turn on the m (multiline) flag so they match at the start and end of every line.
. does not match across lines- Turn on the s (dotAll) flag, or use [\s\S] instead of the dot.
More from Generators & Testers
Free tools that run in your browser — no signup, nothing uploaded.
Cron Expression Generator
Build cron schedules, read them in plain English and preview next runs.
UUID / GUID & ULID Generator
Generate UUID v4, v7 and ULID identifiers, or inspect an existing one.
Epoch converter online
Convert UNIX timestamps to human-readable dates and back instantly.
Time Zone Converter
Convert a time between time zones and compare cities side by side.
Random Number Generator
Generate random numbers in any range — unique, sorted or decimals.
Random String & Token Generator
Generate secure random strings, API keys and tokens of any length.
URL Slug Generator
Turn titles into clean, SEO-friendly URL slugs.
Chmod Permissions Calculator
Convert Linux file permissions between octal (755) and symbolic (rwxr-xr-x).
Semver Range Checker & Calculator
Check which versions match an npm semver range, compare and bump versions.
Regex Tester FAQ
JavaScript (ECMAScript) regular expressions, using your browser's built-in RegExp engine. Results match what you get in Node.js, Chrome, Firefox and Safari.
g finds all matches instead of the first, i ignores case, m makes ^ and $ match at each line, s lets . match newlines, and u enables full Unicode matching including \p{...} property escapes.
Wrap part of the pattern in parentheses, e.g. (\d{4})-(\d{2}). Each group appears as its own column in the match details table. Name a group with (?<year>\d{4}) to see its name.
Turn on Replace and use $1, $2 for numbered groups, $<name> for named groups, $& for the whole match and $$ for a literal dollar sign.
Without the g (global) flag JavaScript stops after the first match. Tick the global checkbox to find every match.
Common causes are an unescaped special character such as ( [ { + * ? . or \, an unclosed group, or lookbehind syntax in an old browser. The error message under the pattern explains the problem.
