import re
#提取出python
key = 'javapythonc++php'
print(re.findall('python',key)[0])
# 提取hello world
key = '<a><h1>hello world</h1></a>'
print(re.findall('<h1>(.*)</h1>',key)[0])
# 提取170
key = '我升高170'
print(re.findall('\d+',key)[0])
#提取 http:// 与 https://
key = 'http://www.baidu.com https://www.'
print(re.findall('https{0,1}://',key))
#提取hit
key ='bobo@hit.com.cn'
print(re.findall('h.*?\.',key)[0]) # 贪婪模式,根据正则表达式尽可能的提取出数据
# 匹配sas 与 saas
key = 'saas and sas and saaas'
print(re.findall('sa{1,2}s',key))
# 匹配出i开头的行 re.S(基于单行) re.M(基于出行)
key ="""1234
i like
i think
"""
print(re.findall('^i.*',key,re.M))
# 匹配全部行
key = """<div>123
456
789</div>"""
print(re.findall('<div>.*</div>',key,re.S))