Regex Tester

Test Regular Expressions with Live Matching

Test Your Pattern

Regex Pattern Basics

Metacharacters define patterns:

  • . - Any character
  • \d - Digit
  • \w - Word character
  • \s - Whitespace
  • ^$ - Start/end anchors

Quantifiers control repetition: * zero+, + one+, ? optional, {n,m} between n and m.

Common Regex Patterns

PatternUse
[\w.-]+@[\w.-]+\.\w+Email
\d{3}[-.]?\d{3}[-.]?\d{4}Phone
https?://[\w.-]+URL
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}IPv4
#[0-9A-Fa-f]{6}Hex color

Regex Flags

  • g - Global, find all
  • i - Case insensitive
  • m - Multiline
  • s - Dot matches newline

Advanced Patterns

(...) capture groups. ([a-z])\1 matches "aa". foo(?=bar) matches "foo" before "bar" (lookahead).

Frequently Asked Questions

How to test a regex?Enter pattern, type test text, select flags, click "Test Match".
What are regex flags?They modify pattern behavior: g (global), i (case insensitive), m (multiline), s (dotall).
Match special characters?Escape with backslash: \. matches a literal period.
What are capture groups?Parentheses () extract matched parts like (\d+) to capture digits.
Why no match?Check escaping, verify flags (use g for multiple), ensure anchors are correct.
Case insensitive?Enable the "i" flag checkbox.