info ='my name is xiao ming, and i am major in english'
result = re.search('x([a-zA-Z])a', info)print(result)<re.Match object; span=(11,14),match='xia'>
\d:匹配十进制数字 findall((‘规则’,变量)匹配多次
info ='my name is xiao ming, and i am major in english,i am 30 years old.'
result = re.search('\d', info)print(result)
result_1 = re.findall('\d', info)print(result_1)<re.Match object; span=(53,54),match='3'>['3','0']
\s:匹配任何空格字符,包括\n\t\r\v\f.
info ='my name is xiao ming, and i am major in english,i am 30 years old.'
result = re.findall('\s', info)print(result)[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']
\z($):匹配字符串结尾
import re
info ='my name is qin simeng, and i am major in english'print(re.findall('english\Z', info))print(re.findall('lish\Z', info))print(re.findall('my\Z', info))['english']['lish'][]
\A(^):匹配字符串开头
info ='my name is xiao ming, and i am major in english,i am 30 years old.'
result = re.findall('\Amy', info)print(result)['my']
\w+:匹配一次或多次数字或者字母。
info ='dewei@immoc.com'
result = re.findall('\w+', info)print(result)['dewei','immoc','com']# 意思是用符号把数字、字母组合拆开,返回一个列表。