Skip to the tool

Regex Tester

Test regular expressions with live match highlighting, capture groups, and common flags.

1 matches

A regular expression is a pattern that describes a set of strings. It is used for searching, validating, and extracting text in almost every programming language and text editor.

Flags change matching behavior: 'g' finds all matches, 'i' ignores case, 'm' makes ^ and $ match line boundaries, and 's' lets '.' match newlines. Choosing the wrong flags is a common source of 'no match' confusion.

The 'g' flag finds all matches; without it only the first match is returned. The 'i' flag makes the pattern case-insensitive, which is often what you want for log parsing.

Common uses

Frequently asked questions

What is catastrophic backtracking?
Nested quantifiers like (a+)+ can make the regex engine try exponentially many paths. Rewrite with more specific character classes or possessive-like patterns to avoid it.
Why does .* not match across lines?
By default '.' excludes newline characters. Add the 's' (dotAll) flag to make it match any character including line breaks.
What is the difference between match and test?
test() returns a boolean for 'does it match anywhere'; match() returns the matched strings. test() is faster when you only need a yes/no answer.
What does 'g' do?
The global flag returns every match, not just the first. Without it you only see the leftmost match.

Related tools