ibramoh ibramoh - 1 year ago 229
Python Question

IP address regex python

I am having an issue with Regular expression, I need the most efficient regex that
match IP address and in range of 255 only.

I tried this one "

ip_pattern = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
" , but it does match even numbers over 255, such as 321.222.11.4

Answer Source

This should do it:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download