'''
"^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\\d{8}$";
'''
regex = "^((13[0-9])|(14[5-9])|(15([0-3]|[5-9]))|(16[6-7])|(17[1-8])|(18[0-9])|(19[1|3])|(19[5|6])|(19[8|9]))\\d{8}$"
mobile_result = re.match(regex, txt_mobile)
if not mobile_result:
raise ValidationError("不存在的号码格式")
正则表达式匹配电话号码
于 2023-05-10 10:37:49 首次发布