IPv4
What this is
A naive \d{1,3} accepts 999.999.999.999. Tighten each octet to 25[0-5]|2[0-4]\d|1?\d?\d if you need validity. For storage, parse and range-check in code.
/\b(?:\d{1,3}\.){3}\d{1,3}\b/gGateway 192.168.0.1 and 10.0.0.2 999.1.1.1 looks like IPv4 but is not valid.
FAQ
- CIDR?
- This does not match 10.0.0.0/8. Add (?:/(3[0-2]|[12]?\d)) if you need prefixes.