import re
text='''Apple-1
orange-2'''
result1=re.findall(r'apple',text)
print('result1:',result1) # result1: []
# re.I 大小写不敏感
result2 = re.findall(r'apple', text,re.I)
print('result2:', result2) # result2: ['Apple']
result3 = re.findall(r'Apple.*?orange', text)
print('result3:', result3) # result3: []
# re.S 使.匹配包括换行在内的所有字符
result4 = re.findall(r'Apple.*?orange', text, re.S)
print('result4:', result4) # result4: ['Apple-1\n orange']
result5 = re.findall(r'\d$', text)
print('result5:', result5) # result5: ['2']
# re.M 多行匹配
result6 = re.findall(r'\d$', text, re.M)
print('result6:', result6) # result6: ['1', '2']