Value METRIC (\d+)
Value NETWORK (\S+)
Value NEXTHOP_IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
Value NEXTHOP_IF (\S+)
Value PROTOCOL (\S+)
Value REACHABILITY (\S+)
Value SCOPE (\S+)
Value SRC (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})

Start
  # These need to match early
  ^\s*unreachable
  ^\s*broadcast
  ^\s*local
  ^\s*${NETWORK}(?:\s+via\s+${NEXTHOP_IP})?(?:\s+dev\s+${NEXTHOP_IF})?(?:\s+proto\s+${PROTOCOL})?(?:\s+scope\s+${SCOPE})?(?:\s+src\s+${SRC})?(?:\s+metric\s+${METRIC})?(?:\s+${REACHABILITY})?\s*$$ -> Record
  ^. -> Error
