
import re
print(re.match('.*hello', 'ahello'))<re.Match object; span=(0, 6), match='ahello'>s = 'Today is 2020-02-21.'
m = re.match('.*\d{4}-\d{2}-\d{2}.*', s)
if m is not None:
print(m.group())Today is 2020-02-21.原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。