Regex Tester

Live regular expression tester β€” highlights matches, shows capture groups, flag toggles (g/i/m/s).

/ /
Test string

What is Regex Tester?

Regex Tester is an interactive regular expression debugger that highlights matches in real time, explains each part of the pattern, and shows capture group values. It supports JavaScript, Python, PCRE, and .NET regex flavors with full flag support (global, case-insensitive, multiline, dotAll, sticky, unicode).

A regular expression (regex) is a pattern that describes a set of strings. It is used to search, validate, extract, and replace text. Regex is built into every major programming language and is fundamental to text processing: validating email addresses, extracting structured data from logs, parsing configuration files, and replacing text patterns.

Common regex pitfalls: catastrophic backtracking (a pattern like (a+)+ that exponentially backtracks on no-match input), greedy vs lazy matching (.* consumes as much as possible; .*? consumes as little as possible), and anchors (^ and $ match start/end of string in single-line mode but start/end of line in multiline mode). This tester shows match timing to help detect performance problems.

How to Use

  1. Enter your regular expression in the Pattern field (without surrounding slashes).
  2. Select flags from the checkboxes: g for all matches, i for case-insensitive, m for multiline, s for dotAll.
  3. Paste or type your test string β€” matches highlight in real time.
  4. Click on any highlighted match to see capture group values in the Groups panel.
  5. Use the Explanation panel on the right to see a plain-English breakdown of each pattern component.

Examples

Email validation pattern

Result: ^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$ β€” matches standard email addresses

Extract all URLs from text

Result: https?://[^\s]+ with flag g β€” finds every http/https URL in the test string

Named capture groups

Result: (?P\d{4})-(?P\d{2})-(?P\d{2}) β€” matches 2026-07-26 and captures groups named year=2026, month=07, day=26

Frequently Asked Questions

What is the difference between greedy and lazy matching?

.* is greedy β€” it matches as many characters as possible. .*? is lazy β€” it matches as few as possible. On the string 'onetwo', .* matches the entire string (greedy), while .*? matches each tag separately (lazy).

What does the ^ anchor match?

In default mode, ^ matches the start of the entire string. With the multiline (m) flag, ^ matches the start of each line. Similarly, $ matches the end of the string normally, or the end of each line with multiline mode.

How do I match a literal dot?

In regex, . matches any character. To match a literal dot, escape it: \. In a character class [.] also matches a literal dot because most metacharacters lose special meaning inside [].

What are non-capturing groups?

(?:...) groups a subpattern without creating a numbered capture group. Useful when you need grouping for repetition ((?:ab)+) or alternation ((?:cat|dog)s?) but don't need to extract the match. They are slightly faster and don't consume a capture group number.

How do I match Unicode characters?

In JavaScript with the u flag, \p{Letter} matches any Unicode letter. In Python 3, \w matches Unicode word characters by default. Use character class ranges or Unicode property escapes for specific scripts: \p{Script=Arabic} matches Arabic script characters.

Related Tools