Regex Tester

//g
Flags
Pattern explained— hover any token
([\w.+-]+)@([\w-]+)\.([\w.-]+)
Matches3 matches
Test String

Matches highlight as you type

What is a Regex Tester?

Regex Tester is an online tool that lets you write a regular expression, paste sample text, and instantly see every match highlighted live. Each match is color-coded, numbered, and broken down with its position and capture groups so you can build and debug patterns in seconds.

A regular expression (regex) is a compact language for describing the shape of text. Instead of checking "is this an email?" you describe the shape — digits around an @ sign, a run of word characters after order # — and the engine finds the matching text for you. Developers use regex to validate input, extract data, search logs, clean text, and power search-and-replace rules. Because matching runs in your browser, your input never leaves the page.

Why use a Regex Tester?

Regex fails quietly: a pattern can look correct in one example and miss your real data. A live tester turns that into immediate visual feedback.

  • Instant feedback: every keystroke updates the highlighted matches and capture groups.
  • Capture groups show the parts you actually need — an ID, a domain, a log level.
  • Inline explanations: hover any pattern token to see what it means.

The building blocks of regular expressions

A pattern is literal characters plus special tokens. Square brackets define a character class: [aeiou] matches any vowel, [0-9] any digit, [^0-9] anything but a digit. Shorthands cover common classes: \d a digit, \w a word character, \s whitespace; uppercase inverts them. The dot . matches any character except a newline.

Anchors match a position, not a character: ^ the start, $ the end, \b a word boundary — so \bcat\b matches cat but not catalog. Quantifiers repeat the previous token: * zero or more, + one or more, ? zero or one, {n,m} a range. Parentheses both group and capture: (\d{4})-(\d{2})-(\d{2}) matches an ISO date and stores the year, month, and day. Use (?:...) when you only need grouping.

| means "or", and lookarounds assert without consuming: q(?=u) matches a q followed by u, q(?!u) a q not followed by u.

Greedy vs lazy quantifiers

Quantifiers are greedy by default. Against <b>hello</b>, <.+> matches the entire string; <.+?> stops at the first >. When a pattern sits between two delimiters, the lazy version is almost always what you want.

Flags

  • g (global) — find every match instead of the first.
  • i (ignore case) — ERROR matches error.
  • m (multiline) — ^ and $ match per line.
  • s (dotAll) — . matches newlines too.
  • u (unicode) — full Unicode support and \p{...} classes.
  • y (sticky) — match must start at the last index.

Common regex mistakes

  • Forgetting to escape special characters — prefix . ? + ( ) [ ] { } with a backslash when literal.
  • No anchors for validation — without ^...$, [email protected] junk can still pass an email regex.
  • Greedy between delimiters — use .*? instead of .*.
  • One happy-path sample only — real data has spaces, newlines, Unicode.
  • Nested quantifiers like (a+)+ can cause catastrophic backtracking — keep groups and quantifiers flat.

How to use the Regex Tester online

Type your pattern (no surrounding / slashes), toggle flags, and paste your test string — matches light up as you type. Click any match row to jump to it, or load a built-in example to explore.

Is JavaScript regex the same everywhere?

The fundamentals work identically across JavaScript, PCRE, Python, Java, Go, and .NET. Advanced features (lookbehind, named groups, possessive quantifiers, Unicode properties) differ between engines, so test with the engine your code runs on.

Enjoying the tools? Support the project!

Buy me a coffee