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

str = "hello world"

#Check if the string starts with 'hello':

x = re.findall("^hello", str)
if (x):
  print("Yes, the string starts with 'hello'")
else:
  print("No match")
运行结果: