python only parses the first level of json duplicate

Try this:

(?<=info\":).*(?=,\"mac\")

Demo

python3 code:

import re

test = """{"info":{"keyVersion":1,"timestamp":"2020-11-05 20:00:00","encryptedData":"75657374696f6e732068617665207265636569"},"mac":"4d6163204b65792049732048455245"}"""
print(*re.findall(r"(?<=info\":).*(?=,\"mac\")", test))

Demo

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top