Regular Expressions Greedy & Non-greedy Selection; regex

Content

If your regex pattern is too greedy, that is, it finds the largest matching case when you want it to find the smallest matching pattern, use a non-greedy selection.

Replace the greedy quantifier with the corresponding non-greedy version.

"...change * , + , ? , and {} into *? , +? , ?? , and {}? , respectively"
fromto
**?
++?
???
{}{}?

More from the Perl Cookbook http://docstore.mik.ua/orelly/perl/cookbook/ch06_16.htm