import remobile = '18312423454'MOBILE = "^1[358]d{9}$|^147d{8}$|^179d{8}$"p = re.compile(MOBILE)if p.match(mobile): print(mobile)