regex

regex-greedy

Greedy means it will go towards the end of line and will NOT stop at first match if there are other matches available.

'.*'  = Greedy
'.*?' = Lazy

Lazy has extra character (?) in the regex syntax. Similarly you can use ‘+’ operator instead of ‘*’

'.+'  = Greedy
'.+?' = Non Greedy (also called Lazy, Reluctant)

‘+’ mean one or more characters
‘*’ mean zero or more characters