You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
390 B
15 lines
390 B
import re
|
|
|
|
def isIP(str):
|
|
p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$')
|
|
if p.match(str):
|
|
return True
|
|
else:
|
|
return False
|
|
def isPORT(str):
|
|
p = re.compile(r'^(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$')
|
|
if p.match(str):
|
|
return True
|
|
else:
|
|
return False
|