"Deven T. Corzine" <[EMAIL PROTECTED]> writes:

>I've yet to see a concrete example of where the current behavior is
>helpful,

What about matching C comments?

   ($first_comment) = $code =~ m!(/\*.*?\*/)!s;
           # (ignore issues with quoted strings in $code

Works correctly under the current behavior.  It would break under you 
proposal (if I understand your proposal correctly).

More generally, it seems to me that you're hung up on the description 
of "*?" as "shortest possible match".  That's an ambiguous 
simplification of what "*?" means.  It might better be described as 
"match until you find a match for the rest of the regex" ('d' in your 
example).  If oversimplifications in the documentation led you to 
believe that "*?" meant something it was never intended to mean, then 
perhaps the documentation should be clarified.  But the meaning of 
"*?" should not be changed.

Final point:  In your example, /b[^bd]*d/ does what you want, and is 
arguably easier to understand.  Can you think of any examples where 
it's not this easy to get the behavior you desire?

Reply via email to