' + '

Regex Tester

Test regex patterns with live matching

Regex Syntax Quick Reference

Regular expressions are a mini-language for describing text patterns. The core building blocks:

Flags

Greedy vs. Lazy

Quantifiers (*, +, {n,m}) are greedy by default — they consume as much as possible. Add ? to make them lazy: .*? matches as little as possible. This matters most when matching delimited content like HTML tags: <.+> will match from the first < to the last > in the string, while <.+?> stops at the first closing >.

Lookahead and Lookbehind

(?=...) is a positive lookahead — asserts what follows without consuming it. (?<=...) is a positive lookbehind. Their negative counterparts are (?!...) and (?<!...). These are useful for matching text only when it's preceded or followed by a specific pattern without including that pattern in the match itself.