Regex Tester & Debugger

Test and debug regular expressions in real-time. Enter your pattern and sample text to see matches highlighted instantly with detailed match information and capture groups.

Live Match Highlighting
Match Count & Details
Capture Groups

Regex Tester

Enter your regex pattern and test text below. Matches will be highlighted automatically as you type.

Regular Expression Pattern

Results

0 matches

Highlighted Output

Enter a pattern and test text to see results...

Match Details

No matches yet

Regex Pattern Guide

Learn the essential regular expression patterns and metacharacters.

Common Regex Patterns

  • \d - Matches any digit (0-9)
  • \w - Matches any word character (letters, digits, underscore)
  • \s - Matches any whitespace character (space, tab, newline)
  • . - Matches any character except newline
  • ^ - Matches the start of a line
  • $ - Matches the end of a line

Quantifiers

  • * - Matches 0 or more times
  • + - Matches 1 or more times
  • ? - Matches 0 or 1 time
  • {n} - Matches exactly n times
  • {n,} - Matches n or more times
  • {n,m} - Matches between n and m times

Useful Examples

  • Email: \b[\w.%+-]+@[\w.-]+\.[A-Za-z]{2,}\b
  • URL: https?://[\w.-]+\.[\w]{2,}[^\s]*
  • Phone (US): \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}
  • Hex Color: #[0-9A-Fa-f]{6}\b
  • Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}

Flags Explained

g (global): Find all matches rather than stopping after the first match.

i (case-insensitive): Ignore case when matching letters (A = a).

m (multiline): ^ and $ match the start/end of lines, not just the string.

s (dotAll): Dot (.) matches newline characters as well.

Frequently Asked Questions

Common questions about regular expressions and testing.

How do I escape special characters in regex?

Use a backslash (\) before special characters like . * + ? ^ $ { } [ ] ( ) | \. For example, to match a literal period, use \. instead of just .

What's the difference between * and + quantifiers?

The * quantifier matches 0 or more occurrences (including none), while + matches 1 or more occurrences (at least one required). For example, \d* matches an empty string, but \d+ requires at least one digit.

How do capture groups work?

Capture groups use parentheses to extract specific parts of a match. For example, (\d{3})-(\d{4}) captures the area code and number separately. The Match Details section shows all captured groups for each match.

Why isn't my regex matching anything?

Common issues include: forgetting to escape special characters, incorrect flag settings (try enabling 'i' for case-insensitive), or overly strict patterns. Start simple and add complexity gradually. Check if your pattern works with a known matching string first.