Regex Tester

Test regular expressions in real-time with match highlighting, capture groups, and common patterns.

//g

What is a Regex Tester?

A regex tester lets you write and test regular expressions against sample text with live match highlighting. Regular expressions (regex) are patterns used to match, search, and replace text in programming. This tool shows capture groups, named groups, and supports all JavaScript regex flags including global, multiline, and unicode.

Common Use Cases

  • Testing email, URL, or phone number validation patterns
  • Debugging complex regex before adding them to code
  • Extracting data from log files with capture groups
  • Learning regex syntax with live feedback
  • Building search-and-replace patterns for text processing

Frequently Asked Questions

What are regex capture groups?

Capture groups, defined with parentheses (), let you extract specific parts of a match. For example, the pattern (\d{4})-(\d{2})-(\d{2}) captures year, month, and day separately from a date string.

What is the difference between greedy and lazy matching?

Greedy quantifiers (*, +, ?) match as much text as possible, while lazy quantifiers (*?, +?, ??) match as little as possible. For example, matching <.*> on '<a>text</a>' captures everything, while <.*?> captures only '<a>'.

Why does my regex work in Python but not JavaScript?

Different languages support different regex features. Python supports lookbehinds with variable length, atomic groups, and named groups with (?P<name>). JavaScript has more limited lookbehind support and uses different syntax for some features.