As you already know hat ungreedy behaviour is, I won't explain that again.
It depends on what comes after the (.*?)
- That's what's ungreedy behaviour for.
Interestingely enough, this means that a regex in the form /(.*?)/
doesn't make much sense - because how can you be lazy, if you match everyting anyway?
If you try to create this regex in e.g. Regexr, it won't even compile, because it's nonsense.
Only if you put something behind the group, your regex will make any kind of sense. I'm not sure if all rege engines do the same as Regexr here and deny to accept that regex.
So, if you want to match anything until a certain character, you'd have to put that specific character after your ungreedy-anything-group. This way, everything before that particular character is matched.
To bring it to a conclusion; it doesn't make any difference, IF there isn't something AFTER the group.