Your mental model of what «.+?» does is severely flawed. For starters, it doesn't permit patterns to have multiple subpatterns that can match substrings of different lengths.
«.+?» does not mean "the shortest possible match within the string that starts with a comma".
«.+» means "one or more non-LF characters, trying in order of decreasing length", and
«.+?» means "one or more non-LF characters, trying in order of increasing length".
Note that lack of mention of comma. «.+?» doesn't do any checks related to commas. The comma is matched independently.
In reply to Re^3: Non-greedy substitution
by ikegami
in thread Non-greedy substitution
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |