in reply to Regex : Return match elements

my @matches = $str =~ /(\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|](\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|]/g;

This doesn't address the basic problem set out in your OP, but here are a few notes about the regex quoted therefrom:

All this allows you to rewrite the original
    my @matches = $str =~ /(\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|](\w+)-(\w+|[0-9]+):(\w+|[0-9]+)\s[&|\|]/g;
statement as the considerably less eye-bezoggling (IMHO)
    my $sep = qr{ [&|] }xms;
    my @matches = $str =~ /(\w+) - (\w+) : (\w+) \s $sep (\w+) - (\w+) : (\w+) \s $sep/xg;
Again, this doesn't actually fix the original problem, but at least it becomes easier to see the problem (again, IMHO).


Give a man a fish:  <%-{-{-{-<