On Fri, Sep 23, 2005 at 09:54:12AM +0100, Brian Candler wrote: > On Thu, Sep 22, 2005 at 04:09:57PM -0700, [EMAIL PROTECTED] via RT wrote: > > The problem with the construct '([^"\\]|\\.)*' is that on each character, > > there are three options to take: match it with '[^"\\]', match it with > > '\\.', > > or don't match it at all (due to the *). > > > > I prefer to match double quoted strings with: > > > > /"[^"\\]*(?:\\.[^"\\]*)*"/s > > > > which eliminates all occurances of an alteration. If the above regex > > matches, > > it doesn't have to backtrack at all. > > Interesting. Unfortunately, this regexp still crashes perl 5.8.7 with a bus > error with my test case. Maybe it's because of the (x*)* construct?
Try instead: /"[^"\\]*(?>\\.[^"\\]*)*"/s