From LedHed's Wiki
Contents
Overview
Here are some common examples of Regex used for form validation.
Phone Numbers
Email Addresses
IP Address Validation
IPv4 Address
^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
IPv4 Subnet in CIDR Notation
^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)($|/([0-9]|[12][0-9]|3[0-2]))$
References
https://www.regextutorial.org/regex-for-ip-address-match.php
https://stackoverflow.com/questions/12141206/ipaddress-or-cidr-block-matching-regex