直接学习:https://edu.csdn.net/course/play/24756/280707
正则表达式-多字符匹配
import re
# *:匹配零个或多个字符
text = 'Aac'
print('='*50)
ret = re.match('\w*',text)
print(ret.group())
print('='*50)
# +:匹配1个或者多个字符
text = '1Aac'
print('='*50)
ret = re.match('\w+',text)
print(ret.group())
print('='*50)
# ?:匹配前一个字符0个或者1个:
text = '1Aac'
print('='*50)
ret = re.match('\w?',text)
print(ret.group())
print('='*50)
# {m}:匹配m个字符:
text = '1Aac'
print('='*50)
ret = re.match('\w{2}',text)
print(ret.group())
print('='*50)
# {m-n}:匹配m-n之间的个数的字符:
text = '1Aac+'
print('='*50)
ret = re.match('\w{1,3}',text)
print(ret.group())
print('='*50)