立即学习:https://edu.csdn.net/course/play/26755/340146?utm_source=blogtoedu
题一:match和search的区别
match:匹配后面所有字符串
search:搜索
import re
m1 = re.match('.*python','I love python')
m 2= re.search('python','I love python')
题二:使用search在字符串中找到第一个手机号,并输出手机号,且输出开始索引和结束索引
m = re.search('1\d{10}','我的手机号是:18877655555')
if m is not None:
print(m.group())
print(m.start())
print(m.end())