in reply to Re: match longest sequence in an "or" RE
in thread match longest sequence in an "or" RE

There is leftmost, and there is leftmost. Perl regular expressions do both. POSIX regular expressions do just one of them.

Oh, which leftmosts are there? Well, there's the leftmost starting point in the target string, and there's the leftmost choice in alternation.

POSIX regular expressions find the leftmost match in the target string, but from all possible matches from that starting point, it will return the longest.

  • Comment on Re^2: match longest sequence in an "or" RE