in reply to Re^2: Is RegEx in Perl not NFA anymore?
in thread Is RegEx in Perl not NFA anymore?

Yes, AnomalousMonk, that's exactly it.

Just for the sake of completeness, these are the two variants of alternations in Perl 6, adapting your example:

> my $s = 'xxxABCDEyyy'; xxxABCDEyyy > say "captured $/" if $s ~~ / ABC | ABCD | ABCDE /; captured ABCDE > say "captured $/" if $s ~~ / ABC || ABCD || ABCDE /; captured ABC
With a single pipe, the longest match wins (which means, BTW, that the engine must try all possibilities to figure out which is the best); with a double pipe, the first match wins.

But that holds only if all possible matches start on the same atom:

> say "captured $/" if $s ~~ / xABC | ABCD | ABCDE /; captured xABC
Here, even though "ADCDE" is a longer match, "xABC" wins because it starts earlier in the string.