https://www.cnblogs.com/python-Specia-Force/p/7784317.html
re過濾Ip地址,稍微高級一點的方法
import re
reg=re.compile(r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')
x = reg.findall('192.168.101.1')
print(x)
reg=re.compile(r'(?:192.168.1)(?:.9)')
x = reg.findall('192.168.1.9')
print(x)
reg=re.compile(r'(192.168.1)(.9)')
x = reg.findall('192.168.1.9')
print(x)
C:\Python36-32\python36.exe D:/py/re_ip.py
['192.168.101.1']
['192.168.1.9']
[('192.168.1', '.9')]
Process finished with exit code 0