import re
1
ip_address=r'((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])'
print(re.fullmatch(ip_address,'255.189.10.37'))
print(re.fullmatch(ip_address,'256.189.89.9'))
2
str1='hello90abc 78sjh12.5'
print(sum(float(x) for x in re.findall(r'\d+\.?\d*',str1)))
3
while True:
str1=input('请输入汉字:')
re_str=r'[\u4e00-\u9fa5]+'
print(re.fullmatch(re_str, str1))
if re.fullmatch(re_str,str1):
break
4
re_str=r'1[^012]\d{9}'
tel='13080196242'
print(re.fullmatch(re_str,tel))
5
abd,bc,abcd,ad,bc