import re
# https://tool.oschina.net/regex/
# 记不住,写不好,看不懂,但是必须会
# str = 'abcd'
# pattern = 'ab'
# res = re.match(pattern, str) # 返回值有None表示没有匹配成功,re.Match对象表示有匹配结果
# print(res) # <re.Match object; span=(0, 2), match='ab'>
# print(res.group()) # 返回匹配成功的字符串ab
#
# print(re.findall(pattern, str)) # ['ab']
str = '32222222222333333'
pattern = '\d*'
res = re.match(pattern, str) # 返回值有None表示没有匹配成功,re.Match对象表示有匹配结果
print(res) # <re.Match object; span=(0, 2), match='ab'>