Your right, the ? does make .+? non-greedy, but the (?:...)? say that you don't mind if the contained expression is missing, so as the .+? can match to the end (of any string), then no attempt is made to match the optional expression that follows it.
Hmm. Maybe this makes more sense? The earlier expression does match to the end of string, and the later (rightmost) expression is optional, so no attempt is made to match the latter.
In reply to Re: Re: Re: Regular Expn Problem
by BrowserUk
in thread Regular Expn Problem
by venkatr_n
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |