Im try to match ip addresses and have come up with the following regular expression for python. I just cannot understand why this wont work. Any help would be greatly appreciated!
r"[0-255]\.[0-255]\.[0-255]\.[0-255]"
Im try to match ip addresses and have come up with the following regular expression for python. I just cannot understand why this wont work. Any help would be greatly appreciated!
r"[0-255]\.[0-255]\.[0-255]\.[0-255]"
Because [0-255]
means any char between 0 to 2 or 5
. switch to something like
r"^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"