import re
"""
匹配出163邮箱,且@符号之前有4-20位英文字母数字或下划线
"""
email1 = "hello@163.com"
email2 = "111@163.com"
email3 = "1311@163.comsss"
email4 = "1311@163.scom"
ret = re.match("^[a-zA-Z0-9_]{4,20}@163\.com$", email3)
if ret:
print("正确,", ret.group())
else:
print("不正确")
笔记 - 正则表达式python:验证163邮箱
最新推荐文章于 2025-07-17 14:21:57 发布