Nope, not my expectations. It's how I took it worked
What you "take how it works" are your expectations, no?
from the Perl Cookbook - near the bottom of page 212:
So far it's correct
But this is at least ambiguous. What it meant is that both match at the
same position.
There is no position in "ALPHABETA" where both /.*ALPHA/ and /BETA/ match:
At position 0, /.*ALPHA/ matches, but /BETA/ doesn't.
At position 5, /BETA/ matches, but /.*ALPHA/ doesn't.
At all other positions, neither /.*ALPHA/ or /BETA/ match.
OTOH, in the string "BETAALPHA",
At position 0, /.*ALPHA/ matches "BETAALPHA", and /BETA/ matches BETA.
At position 1, /.*ALPHA/ matches "ETAALPHA", but /BETA/ doesn't match.
At position 2, /.*ALPHA/ matches "TAALPHA", but /BETA/ doesn't match.
At position 3, /.*ALPHA/ matches "AALPHA", but /BETA/ doesn't match.
At position 4, /.*ALPHA/ matches "ALPHA", but /BETA/ doesn't match.
At all other positions, neither /.*ALPHA/ or /BETA/ match.
(of course, since we already had a match at position 0, the whole
pattern matches and the other positions aren't tried)
hp