使用python来做正则表达式:
import re
txt = "hello world"
#Search for a sequence that starts with "he", followed by two (any) characters, and an "o":
x = re.findall("he..o", txt)
print(x)
#Search for a sequence that starts with "Ha", followed by two (any) characters, and an "g":
txt_new = "Happy coding"
y = re.findall("Ha.*g", txt_new)
print(y)
使用 . 符号,这个符号表示:Any character (except newline character).
结果如下:
如果觉得不错,就点赞或者关注或者留言~
谢谢~ ~