代码示例:(标识:python_regex)
python_regex.py
import re

txt = "China is a great country"
x = re.search("^China.*country$", txt)

if (x):
  print("YES! We have a match!")
else:
  print("No match")
运行结果: