Huh. Multiple beginning-of-line anchors work
I've never had a reason to use multiple beginning-of-line anchors in a regex, so I wondered if it would work. I guess it does.
use v5.10; my $string = <<'HERE'; This is line one This is a cat This is a dog This is a lizard This is a bird That is a ostrich HERE my @matches = $string =~ m/ ^This\ is\ a\ (\S+) \s+ ^This\ is\ a\ (\S+) /xmg; say "Matches are @matches";
Matches are cat dog
Not that you'd ever want to do this. I was curious, I tried it, and now I know. That probably means I'm going to try to get it into production somehow.