import ret ='wwsererfgfgfh({"productId":"111111","wwww":"323243":{}})'# m = re.match("W*productId[^:]*:D*(d+)", t)# if m:# print(m.group(1))re_prodId=re.compile(r'"productId":"([^"]+)"')re=re_prodId.findall(t)print(re)