import re
txt = "hello planet"
# 搜索以 "he" 开头,后跟 0 个或多个(任意)字符,并以 "o" 结尾的序列:
x = re.findall("he.*o", txt)
print(x)