ss='北京奇谈文化有限公司'
print(re.findall('(.*?有限公司){5,20}',ss)[0])
Traceback (most recent call last):
File "<input>", line 1, in <module>
IndexError: list index out of range
print(re.findall('(.*?有限公司){5,20}',ss)[0])
Traceback (most recent call last):
File "<input>", line 1, in <module>
IndexError: list index out of range
print(re.findall('(.*?有限公司)',ss)[0])
北京责任有限公司
print(re.findall('(.*?有限公司){5,20}',ss)[0])
Traceback (most recent call last):
File "<input>", line 1, in <module>
IndexError: list index out of range
为啥我加上限制长度的总是报错呢?匹配不到
{n, m}:m、n都是非负数,最少匹配n次,最多匹配m次。