Regex Tester — Online Regular Expression Tool

/ /
Flags:
Test String
0 matches
Match Details
Test String
Result
📖 Regex Cheat Sheet
Anchors
^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary
Character Classes
.Any char (except newline)
\dDigit [0-9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]Character set
[^abc]Negated set
[a-z]Range
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy 0 or more
+?Lazy 1 or more
Groups
(abc)Capture group
(?:abc)Non-capture group
(?<name>abc)Named group
\1Back-reference to group 1
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind
Replace tokens
$1Group 1
$<name>Named group
$&Whole match
$`Before match
$'After match
$$Literal $
Common Patterns
Emailuser@domain.com
URLhttps://example.com
IPv4192.168.1.1
Hex color#fff or #ffffff
DateYYYY-MM-DD
Phone US(555) 123-4567

How to Use the Regex Tester

  1. Enter your regular expression pattern in the Regex field (without delimiters).
  2. Select flags: g (global), i (case-insensitive), m (multiline), s (dotAll).
  3. Type or paste your test string — all matches are highlighted in real time.
  4. Expand the Details panel to see capture groups, match positions, and use Replace mode to test substitutions.

Why Use a Visual Regex Tester

Regular expressions are one of the most powerful tools in a developer's toolkit — and one of the most error-prone to write without visual feedback. A single misplaced character can change a pattern from "match any email address" to "match nothing" or "match everything." Real-time visual highlighting makes the effect of every character change immediately visible, transforming regex debugging from guesswork into observation.

The included example patterns (email, URL, IPv4, hex color, date, phone number) serve as both working templates and learning references. The regex cheat sheet with clickable examples lets you build complex patterns by assembling known-good components rather than writing from scratch. Capture groups panel shows exactly what each group captures, essential for replacement patterns.

Frequently Asked Questions