代码
import re
str = '13243543423adscvsdftooooooooppprrrrrrr123456453423'
reg_str = '.*(t.*p?).*'
match_result = re.match(reg_str,str)
if match_result:
print(match_result.group(1))
结果
tooooooooppprrrrrrr123456453423
代码
import re
str = '13243543423adscvsdftooooooooppprrrrrrr123456453423'
reg_str = '.*(t.*?p).*'
match_result = re.match(reg_str,str)
if match_result:
print(match_result.group(1))
结果
toooooooop
带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎
了解课程