1 re.match() 函数
总是从字符串‘开头匹配’,并返回匹配的字符串的 match 对象 <class ‘_sre.SRE_Match’>
re.match(pattern, string[, flags=0])
•pattern 匹配模式,由 re.compile 获得
•string 需要匹配的字符串
import re
pattern = re.compile(r'hello')
a = re.match(pattern, 'hello world')
b = re.match(pattern, 'world hello')
c = re.match(pattern, 'hell')
d = re.match(pattern, 'hello