将正则表达式编译成pattern对象
pattern = re.compile(r'hello')
使用pattern匹配文本,获得匹配结果无法匹配时将返回None
语法:re.match(pattern, string, flags=0)
1)match = pattern.match('hello world!')
if match:
print match.group()#输出
2)m = re.match(r'hello','hello world!')
print m.group()