my (@match) = $str =~ /(?:^foo (?=(?:m \d+ )+bar)|(?## my (@match) = $str =~ / (?: ^foo\ (?= (?:m\ \d+\ )+bar) # overall match from ^foo | (?