python re 正则取两个字符之间的字符

import re  
str = 'hihihi>abcdefgid=testgogogo((?:.|n)*?)\<', str)[0]  
# 只有后面是符号  
title2 = re.findall(r'id=((?:.|n)*?)\&', str)[0]  
print('title1 --- ',title1)  
print('title2 --- ',title2)

输出结果

title1 ---  abcdefgid=testgogogo
title2 ---  testgogogo

你可能感兴趣的:(python正则表达式)