python正则表达式bug

代码
hasNextPage=re.search('{"hasNextPage":(.*?),', text)
print(hasNextPage.group(1))
text:
{"isAudienceReview":false,"pageInfo":{"hasNextPage":true,"hasPreviousPage":true,之后省略
为什么会产生错误:AttributeError: 'NoneType' object has no attribute 'group

img

说明没有找到啊,hasNextPage是空的
你是不是哪里写错了,我复制下来运行是正常的:

import re
text = '{"isAudienceReview":false,"pageInfo":{"hasNextPage":true,"hasPreviousPage":true,'
hasNextPage=re.search('{"hasNextPage":(.*?),', text)
print(hasNextPage.group(1))

结果

true

img


我这边运行没有问题,你看看你是不是哪里写错了