Regex Greedy/Lazy.


Regular expressions in Perl are greedy by default, meaning they match as much as possible. Using a question mark (?) makes quantifiers lazy, so they match as little as possible.

Greedy:

Lazy: