Regex Tester

Test a regular expression against sample text, see matches and groups, or run a replace.

Frequently asked questions

What does the regex tester do?

It runs your regular expression against sample text and shows every match and captured group, so you can build and debug patterns quickly.

Which regex flavour is used?

PCRE (Perl-compatible), the same engine used by PHP and very close to JavaScript and Python. Common flags like case-insensitive and multiline are supported.

Why did my pattern time out?

Some patterns cause catastrophic backtracking on certain inputs. The tester limits execution time to stay responsive; simplify the pattern if it is rejected.

What is the difference between greedy and lazy quantifiers?

A greedy quantifier like .* matches as much as possible then backtracks, while a lazy one like .*? matches as little as possible. Choosing the right kind avoids over-matching across delimiters.

What is a capturing versus a non-capturing group?

Parentheses create a capturing group whose matched text you can reference, while (?:...) groups without capturing. Non-capturing groups keep your captured-group numbering clean when you only need grouping.

What is a lookahead and a lookbehind?

These are zero-width assertions that check for a pattern without consuming characters. A lookahead (?=...) requires what follows, and a lookbehind (?<=...) requires what precedes, letting you match based on context.

How do I match a literal special character?

Escape it with a backslash, so a literal dot is written as a backslash followed by a dot, and similarly for other metacharacters like parentheses, brackets and the plus sign.

What do anchors like caret and dollar do?

The caret matches the start of the string or line and the dollar matches the end. With the multiline flag they apply to each line, which is useful for validating input line by line.