Skip to content

Regex ipv4, ipv6, mac et fqdn

ipv4:
(([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])

ipv6:
([A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}

MAC:
(([a-fA-F0-9]{1,2}-){5})([a-fA-F0-9]{1,2})

FQDN:
(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])