Quick difference between "greedy" and "lazy" in regex: consider a phrase with nested parentheses, e.g. (the quick (brown) fox jumps over the lazy dog)
.
The lazy regex \(.*?\)
captures only up to the first end parenthesis, i.e.(the quick (brown)
Whereas the greedy one \(.*\)
captures all the way to the end (the quick (brown) fox jumps over the lazy dog)
.