0
Regular expression (Regex) for validating ip address?
2 ответов
+ 3
for ipv4 easiest regex would be
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
but major flaw on this, is
999.999.999 is still correct ¯\_(ツ)_/¯
maybe regex isnt the best way
+ 2
Fully correct for IPv4:
((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])