我有这个Python3正则表达式:
i = "some string wow https://www.amazon.ca/product-product-name"
print(re.match(r'\^https:\/\/www.amazon.[\b"com","ca"](.*)\g', i))
我收到此错误:
sre_constants.error: bad escape \g at position 41
答案 0 :(得分:2)
这里:
i = "some string wow https://www.amazon.ca/product-product-name"
print(re.findall(r'https://www\.amazon\.(?:com|ca)/(?:[^\s]+)', i))
打印:
['https://www.amazon.ca/product-product-name']