Python鉴定区分电话号码(正则)

电话号码分类:

  1. 正常手机 13312345678                                        11
  2. 外地手机 0 13312345678 (座机拨打,需要加0)                12
  3. 正常座机 0345 1234567  (二线城市)                          11
  4. 正常座机 010 12345678  (大城市)                            11
  5. 正常座机  12345678    (大城市本地)                         7
  6. 正常座机  1234567     (二线城市本地)                       8
  7. 转呼 400 800           (商业用途)                          10

电话号码鉴定(python):

1 . 加0的外地手机号

^01(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$

2.正常手机号       

^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$

3 .有区号的 一线城市+港澳台

'^(010|02[0-57-9]|852|853)\d{8}$’

4.外呼特殊号码

^(400|800)\d{7}$

5.有区号的 二线城市

re.compile('^\d{11}$').match(phone) and company_phone[0:4] in Area_Code

Area_Code = ['010', '020', '021', '022', '023', '024', '025', '027', '028', '029', '853', '852', '0310', '0311',
             '0312', '0313', '0314', '0315', '0316', '0317', '0318', '0319', '0335', '0349', '0350', '0351', '0352',
             '0353', '0354', '0355', '0356', '0357', '0358', '0359', '0370', '0371', '0372', '0373', '0374', '0375',
             '0376', '0377', '0379', '0391', '0392', '0393', '0394', '0395', '0396', '0398', '0411', '0412', '0415',
             '0416', '0417', '0418', '0419', '0421', '0427', '0429', '0431', '0432', '0433', '0434', '0435', '0436',
             '0437', '0438', '0439', '0451', '0452', '0453', '0454', '0455', '0456', '0457', '0458', '0459', '0464',
             '0467', '0468', '0469', '0470', '0471', '0472', '0473', '0474', '0475', '0476', '0477', '0478', '0479',
             '0482', '0483', '0510', '0511', '0512', '0513', '0514', '0515', '0516', '0517', '0518', '0519', '0523',
             '0527', '0530', '0531', '0532', '0533', '0534', '0535', '0536', '0537', '0538', '0539', '0543', '0546',
             '0550', '0551', '0552', '0553', '0554', '0555', '0556', '0557', '0558', '0559', '0561', '0562', '0563',
             '0564', '0565', '0566', '0570', '0571', '0572', '0573', '0574', '0575', '0576', '0577', '0578', '0579',
             '0580', '0591', '0592', '0593', '0594', '0595', '0596', '0597', '0598', '0599', '0631', '0632', '0633',
             '0634', '0635', '0660', '0662', '0663', '0668', '0691', '0692', '0701', '0710', '0711', '0712', '0713',
             '0714', '0715', '0716', '0717', '0718', '0719', '0722', '0724', '0728', '0730', '0731', '0734', '0735',
             '0736', '0737', '0738', '0739', '0743', '0744', '0745', '0746', '0750', '0751', '0752', '0753', '0754',
             '0755', '0756', '0757', '0758', '0759', '0760', '0762', '0763', '0766', '0768', '0769', '0770', '0771',
             '0772', '0773', '0774', '0775', '0776', '0777', '0778', '0779', '0790', '0791', '0792', '0793', '0794',
             '0795', '0796', '0797', '0798', '0799', '0812', '0813', '0816', '0817', '0818', '0825', '0826', '0827',
             '0830', '0831', '0832', '0833', '0834', '0835', '0836', '0837', '0838', '0839', '0851', '0854', '0855',
             '0856', '0857', '0858', '0859', '0870', '0871', '0872', '0873', '0874', '0875', '0876', '0877', '0878',
             '0879', '0883', '0886', '0887', '0888', '0891', '0892', '0893', '0894', '0895', '0896', '0897', '0898',
             '0901', '0902', '0903', '0906', '0908', '0909', '0911', '0912', '0913', '0914', '0915', '0916', '0917',
             '0919', '0930', '0931', '0932', '0933', '0934', '0935', '0936', '0937', '0938', '0939', '0941', '0943',
             '0951', '0952', '0953', '0954', '0955', '0970', '0971', '0972', '0973', '0974', '0975', '0976', '0977',
             '0979', '0990', '0991', '0992', '0993', '0994', '0995', '0996', '0997', '0998', '0999']

5.普通座机 7或8位

'^\d{7-8}$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值