Conceptual

Greedy vs Lazy Quantifiers in Regex

By default a quantifier takes the longest match it can; adding ? makes it take the shortest. The classic failure is <.*> swallowing an entire line of HTML when <.*?> was meant, and it is invisible until the input contains two matches on one line.