Value DESTINATION_ADDRESS ([0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4})
Value TYPE (\S+)
Value VLAN_ID (\S+)
Value List DESTINATION_PORT ([^,\s]+)

Start
  ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port -> TYPE1
  ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports -> TYPE2
  ^\s+vlan\s+mac address\s+type\s+protocols\s+port -> TYPE3
  ^Vlan\s+Mac Address\s+Type\s+Ports -> TYPE4
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is

TYPE1
  ^${DESTINATION_ADDRESS}\s+${TYPE}\s+${VLAN_ID}\s+${DESTINATION_PORT}$$ -> Record
  ^-+\s+-+
  ^Displaying\s+entries
  ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE2
  # Order of the group in brackets here matters
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*(\d+|-+|[Nn]/[Aa]) -> Continue.Record
  # using 20 spaces should ensure that lines only match destination port flowing to next line
  ^\s{20}\s+${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+${DESTINATION_PORT},*\s*$$
  ^\s{20}\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT},*\s*$$
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT},*\s*$$
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT},*\s*$$
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT},*\s*$$
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s{20}\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+[^,\s]+?(\s+|,\s*)${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT},*\s*$$
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
  ^\s*(\*\s+[R,S,D]|\*|[R,S,D]|\s)\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT},*\s*$$
  ^-+\+-+
  ^Displaying\s+entries
  ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE3
  ^\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT}(?:\s|$$) -> Record
  ^-+\+-+
  ^Displaying\s+entries
  ^\s+vlan\s+mac address\s+type\s+protocols\s+port
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE4
  ^\s*${VLAN_ID}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT}(?:\s|$$) -> Record
  ^-+\s+-+
  ^Displaying\s+entries
  ^Vlan\s+Mac Address\s+Type\s+Ports
  ^\s*$$
  ^Total\s+Mac\s+Addresses
  ^MultiCast\s+Entries -> End
  ^. -> Error
