Python: mobile phone number verification

# 表单验证类
class VerifyUtil:
    @staticmethod
    def verify_phone(phone):
        # 手机号码格式的正则表达式
        reg = '^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$'
        return re.match(reg, phone)

 

Guess you like

Origin blog.csdn.net/weixin_38676276/article/details/107991890