* Your content are not transferred to the server. All calculations are performed directly in the browser
Enter a regex pattern to get started

What is a Regex Tester?

A regex (regular expression) tester is an interactive tool that lets you build and test regex patterns against sample text in real time.

As you type, matches are highlighted directly in the test text, and a detailed match list shows each match with its position, captured groups, and length.

This tool runs entirely in your browser — no data is ever sent to any server.

Key Features

  • Real-time match highlighting — see matches visually in your test text with alternating colors for clarity.
  • Capture group inspection — view named and numbered capture groups for each match.
  • Replacement preview — test regex-based find-and-replace with support for $1, $&, and '$<name>' replacement tokens.
  • Pattern explanation — token-level breakdown of your regex, showing what each part means (e.g., \d+ → "one or more digits").
  • Catastrophic backtracking protection — matching runs in a background thread with a timeout, so bad patterns won't freeze the page.
  • Preset library — quick-start with common patterns for email, URL, IP, phone, passwords, and more.

Common Use Cases

  • Learning regex — see how each token contributes to matching, and test your understanding against sample text.
  • Debugging — paste an existing regex and test it against actual data to verify it matches what you expect.
  • Data extraction — use capture groups to extract specific parts from log files, CSVs, or structured text.
  • Find and replace — preview complex text transformations before applying them in your code.
  • Validation — test email, phone, URL, and other validation patterns against edge cases.

Cheatsheet

TokenMeaningExample
Character Classes
\dAny digit (0-9)123 → matches 1,2,3
\wAny word character (a-z, A-Z, 0-9, _)a1_ → matches a,1,_
\sAny whitespace (space, tab, newline)"a b" → space match
[...]Custom character class[aeiou] → vowels
[^...]Negated character class[^0-9] → non-digits
Anchors & Boundaries
^Start of string"^hello" → at start
$End of string"end$" → at end
\bWord boundary"\bword\b" → word
\BNon-word boundary"\Bing\B" → inside
Quantifiers
*Zero or morea* → "", a, aa, aaa
+One or morea+ → a, aa, aaa
?Zero or onea? → "", a
{n}Exactly na{3} → aaa
{n,}At least na{2,} → aa, aaa
{n,m}Between n and ma{2,4} → aa, aaa, aaaa
*?, +?, ??Lazy variant (match as few as possible)"<.*?>" → shortest match
Groups & Lookaround
(...)Capturing group(abc)+ → capture abc
(?:...)Non-capturing group(?:abc)+ → group w/o capture
(?<name>...)Named capturing group"(?<year>\d{4})"
(?=...)Positive lookaheadq(?=u) → q followed by u
(?!...)Negative lookaheadq(?!u) → q not followed by u
(?<=...)Positive lookbehind"(?<=@)\w+"
(?<!...)Negative lookbehind"(?<!@)\w+"
Escapes
\nNewline"line\n" → newline
\tTab"col\t" → tab
\\Literal backslash"c:\\path"
\.Literal dot"end\." → literal dot
\/Literal forward slash"path\/to\/file"

Limitations

  • JavaScript regex only — this tool uses the browser's built-in regex engine. PCRE, Python, and other regex flavors may behave differently.
  • No lookbehind in older browsers — lookbehind assertions (?<=...) require ES2018+. Safari only added support in 2023.
  • Match cap at 1,000 — to keep the UI responsive, only the first 1,000 matches are rendered.
  • Capturing groups not highlighted in text — groups are shown in the match list, not inline in the highlighted text.