py正则表达式匹配出错

以下为代码


import re
pattern =r'(13[4-9]\d{8}$|(15[01289]\d{8})$'
mobile = '13634222222'
match = re.match(pattern,mobile) #进行模式匹配
if match == None:                #判断 是否为None,为真表示匹配失败       
    print(mobile,'不是有效的中国移动电话号码')
else:
    print(mobile,'是有效的中国电话号码')
mobile = '13144222221'
match = re.match(pattern,mobile) #进行模式匹配
if match == None:                #判断 是否为None,为真表示匹配失败       
    print(mobile,'不是有效的中国移动电话号码')
else:
    print(mobile,'是有效的中国电话号码')

以下为报错

Traceback (most recent call last):
  File "C:\Users\LX\Documents\py\0819.py", line 23, in <module>
    match = re.match(pattern,mobile) #进行模式匹配
  File "C:\Users\LX\Documents\py\lib\re.py", line 190, in match
    return _compile(pattern, flags).match(string)
  File "C:\Users\LX\Documents\py\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Users\LX\Documents\py\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Users\LX\Documents\py\lib\sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\LX\Documents\py\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Users\LX\Documents\py\lib\sre_parse.py", line 836, in _parse
    raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 0

求问哪里有问题呢

pattern = r'(13[4-9]\d{8})$|(15[01289]\d{8})$'

(13[4-9]\d{8}) ,少一个右边的括号

第三行,正则表达式
|前的表达式漏了一个右括号),
然后,|两边的括号都应包住$
应改为

pattern =r'(13[4-9]\d{8}$)|(15[01289]\d{8}$)'

如果有用,麻烦点击采纳谢谢!

电脑号码的正则匹配规则不对,换成这个:

"^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$"