Regex Tester

A regex tester is where regular expressions stop being scary. Regex is the fastest way to validate emails, extract data, and clean text — but one wrong character and the pattern silently matches nothing. Testing against real text, live, is how you learn what each symbol actually does. Even experienced developers keep a tester open while writing patterns, because regex is a write-only language: obvious when written, mysterious a week later.

This free regex tester highlights matches as you type, lists every match with its capture groups, supports all major flags, includes one-click presets, and even previews replacements. No signup, everything runs in your browser. You can also start from presets — email, URL, date, phone number — and tweak them, which is far faster than writing a pattern from scratch.

Regex Tester

Test regular expressions live — matches highlight as you type, with groups and replacements.

🔒 100% private — everything runs in your browser, nothing is uploaded.

How to Use the Regex Tester

  1. Type your pattern in the pattern box — or click a preset (email, URL, date, phone, IPv4, hex color, hashtag, HTML tag) to load a working example.
  2. Tick flags as needed: i for case-insensitive, m for multiline anchors, s so dot matches newlines, u for Unicode, y for sticky matching.
  3. Paste your test string. Matches highlight in yellow the instant you type; the match list shows each match, its index, and its capture groups.
  4. Try replacements. Enter a replacement string using $1, $2, or $& to preview find-and-replace behavior live.
  5. Fix errors fast. An invalid pattern shows a clear message naming the problem instead of failing silently.

Features That Set This Tool Apart

  • Live highlighting — this regex tester re-evaluates on every keystroke, so you see exactly what each character change does.
  • Capture group inspector — every match lists its $1, $2… group values, which most simple testers hide.
  • Replacement preview — test find-and-replace logic with backreferences before touching real data.
  • All six flags — global, ignore-case, multiline, dot-all, unicode, and sticky, each toggleable with an explanation.
  • Eight real-world presets — production-ready patterns for emails, URLs, dates, phones, IPs, colors, hashtags, and tags.
  • Clear invalid-pattern errors — JavaScript’s raw regex errors translated into plain language.
  • Match cap with notice — pathological patterns are capped at 300 matches so the page never freezes.
  • 100% private — patterns and test strings never leave your browser.

Regex Tester Basics: Patterns, Flags, and Matches

A regular expression is a miniature language for describing text shapes. \d means “any digit,” + means “one or more,” so \d+ matches any run of digits. Anchors pin matches in place: ^ for start, $ for end. Character classes like [A-Za-z] match any one of the listed characters, and parentheses (…) both group and capture.

Flags change the rules of the game. Without g (global), matching stops at the first hit — the tester enables it by default so you see everything. The i flag folds case, so cat matches “CAT.” The m flag is the subtle one: it makes ^ and $ match at line boundaries instead of only the string’s start and end, which is essential for multi-line logs and documents.

The fastest way to learn is experimental: load the email preset, delete one character at a time, and watch the highlights change. MDN’s regular expressions guide is the authoritative reference when you want the full syntax.

10 Regex Patterns Everyone Should Know

  • Email: [\w.+-]+@[\w-]+\.[\w.]+ — practical validation; true RFC-perfect email regex is pages long and rarely worth it.
  • URL: https?://[^\s/$.?#].[^\s]* — grabs http/https links from text.
  • Date (ISO): \d{4}-\d{2}-\d{2} — matches 2026-09-24 style dates.
  • Phone (loose): \+?[\d\s().-]{7,} — catches international formats; tighten for strict validation.
  • IPv4: (?:\d{1,3}\.){3}\d{1,3} — finds dotted quads in logs (add range checks for strictness).
  • Hex color: #[0-9a-fA-F]{6}\b|#[0-9a-fA-F]{3}\b — matches #fff and #3b82f6 in stylesheets.
  • Hashtag: #[A-Za-z0-9_]+ — social text parsing.
  • HTML tag: <[^>]+> — quick-and-dirty tag finding (never parse real HTML with regex alone).
  • Whitespace cleanup: \s+ replaced with a single space collapses messy spacing.
  • Quoted strings: "[^"]*" — extracts double-quoted values from config-like text.

All except the last two are one click away as presets in the tester above.

5 Regex Mistakes Beginners Make

1. Forgetting to escape the dot. In example.com the dot means “any character” — it matches “exampleXcom” too. Write example\.com for a literal dot. This single mistake causes more false matches than all others combined.

2. Greedy quantifiers eating too much. <.*> on “<b>hi</b>” matches the whole string, not each tag. Add ? to go lazy: <.*?>.

3. Using ^ and $ without the m flag on multi-line text, then wondering why only the first line matches. Toggle m and watch the highlights multiply.

4. Over-anchoring or under-anchoring. Validating with \d+ alone accepts “abc123def.” Wrap it: ^\d+$.

5. Catastrophic backtracking. Nested quantifiers like (a+)+$ can freeze on long inputs. Keep patterns simple, prefer lazy quantifiers, and test with the longest realistic input you have.

Regex Tester: Frequently Asked Questions

How do I test a regex pattern with this tool?

Type your pattern into the pattern box, tick any flags you need (i for case-insensitive, m for multiline, s for dot-all), and paste your test text below. Matches highlight instantly in yellow, and the match list shows every match with its position and captured groups. If the pattern is invalid, you get a clear error instead of silence.

What do the regex flags g, i, m, s, u mean?

The g flag finds all matches instead of stopping at the first. The i flag makes matching case-insensitive. The m flag lets start and end anchors match at line boundaries, not just the whole string. The s flag lets the dot match newlines too. The u flag enables full Unicode handling. Tick any combination in the tool to see how each changes the results.

Why is my regex not matching?

Check the usual suspects: unescaped special characters (a literal dot needs backslash-dot), missing flags (case or multiline), anchors that do not account for surrounding text, and greedy quantifiers eating more than expected — try the lazy version with a question mark. Paste both pattern and text into the tester and watch the highlights to see exactly where matching stops.

How do capture groups work?

Parentheses create groups that remember what they matched. In the pattern with groups around year, month, and day of a date, group 1 holds the year, group 2 the month, and group 3 the day. The match list in this tool shows every group value for each match. In replacements, reference groups with $1, $2, and so on, or $& for the whole match.

Is my test data uploaded anywhere?

No. Pattern matching runs entirely in JavaScript in your browser. Your test strings — even production logs or customer data — are never sent to a server, stored, or logged. Nothing leaves your device, so the tool is safe for sensitive data and keeps working offline once the page has loaded.

  • Email Validator — check email syntax and disposable domains without writing regex.
  • Text Cleaner — normalize whitespace and line breaks in messy pasted text.
  • HTML Minifier — compress HTML for faster pages.
  • All Free Tools — browse the complete collection of free online tools — no signup needed.

Regex rewards experimentation more than memorization. Keep this regex tester open while you work, and patterns that once looked like line noise will start reading like plain instructions.