- 匹配qq号:
re.search('^[1-9][0-9]{4,10}$',qq)
- 匹配用户名:
写法1:re.match('^[a-zA-Z_0-9]{5,20}$',username)
写法2:re.match('^\w{5,20}$',username)
- 匹配邮箱:
result1 = re.match(r'\w{5,20}@(163|126|qq|139)\.(com|cn)$',email)
- 匹配手机号:
result1 = re.match(r'1[35789]\d{9}$',phone)
python之_正则主要应用
最新推荐文章于 2021-10-07 22:01:31 发布