in reply to Re^2: help with lazy matching
in thread help with lazy matching

I like the description in the Camel:

... regular expressions will try to match as early as possible. This even takes precedence over being greedy. Since scanning happens left to right, the pattern will match as far left as possible, even if there is some other place where it could match longer. (Regular expressions may be greedy, but they aren’t into delayed gratification.) ...

(copied from the free sample material on the O'Reilly website, http://cdn.oreillystatic.com/oreilly/booksamplers/9780596004927_sampler.pdf, book page 44)

Another key thing to realize is that the $ does not change the behavior to scanning from right-to-left.