in reply to Re: Re: (bbfu) (dot star) Re: Extract potentially quoted words
in thread Extract potentially quoted words

With minimal matching, however, the engine backtracks after every character. The first thing it tries to match is ", and it fails every time, then backs up and tries matching .+?, until it finds the ". It's doing more work that way, so it's slower.
No, perhaps you are confusing .+ with .+?. With .+?, it's inching forward a character at a time each time it can't find a " immediately there.

-- Randal L. Schwartz, Perl hacker

  • Comment on Re: Re: Re: (bbfu) (dot star) Re: Extract potentially quoted words

Replies are listed 'Best First'.
Re: Re: Re: Re: (bbfu) (dot star) Re: Extract potentially quoted words
by chipmunk (Parson) on Jun 07, 2001 at 21:18 UTC
    With .+?, it's inching forward a character at a time each time it can't find a " immediately there.
    Is that not what I said? With /.+?"/, first the regex engine tries to match a "; then it backtracks and extends .+? . It has to backtrack for every non-quote character before the ", whereas /[^"]"/ only backtracks once, when it gets to the ".