I have plenty of confusion in regular expression and I am trying to solve them. Here I have the following string:
{start}do or die{end}extended string
My two different regexes, where I only changed the position of the dot:
(.(?!{end}))* //returns: {start}do or di
//^ See here
((?!{end}).)* //returns: {start}do or die
//^ See here
Why does the first regex eats the last "e" ?
And also how does this negative lookahead make this * quantifier non greedy? I mean why it can't consume characters beyond {end}?