I stumbled upon this type of problem the other day while perusing through the tutorials section. Chromatic covers this nicely in the
common regex gotchas article on greediness. It's sure saved me hours of hairpulling...
If you're ever lost and need directions, ask the guy on the motorcycle.