import re
regex = re.compile(r"\\\"(.*?)\\\"")
test_str = "{\"unit\":{\"id\":1,\"val\":\"px\",\"name\":\"px\"},\"type\":{\"id\":3,\"val\":\"HORIZONTAL_BAR\",\"name\":\"Horizontal Bar\"},\"zoom\":{\"id\":2,\"val\":\"DEFAULT\",\"name\":\"Show\"},\"scale\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Show\"},\"fullscreen\":{\"id\":1,\"val\":\"FALSE\",\"name\":\"Hide\"},\"street\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Show\"},\"poi\":{\"id\":1,\"val\":\"FALSE\",\"name\":\"Disable\"},\"draggable\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"doubleclick\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"mouse\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"gesture\":{\"id\":2,\"val\":\"auto\",\"name\":\"Auto\"},\"map\":{\"id\":1,\"val\":\"ROADMAP\",\"name\":\"Road Map\"},\"mapid\":\"mapkit-9479\",\"api\":\"\",\"lat\":\"51.343695608206275\",\"lng\":\"-2.4871419408111706\",\"zoomlvl\":13,\"width\":600,\"height\":400,\"position\":{},\"route\":{},\"infowindow\":{\"enable\":false,\"title\":false,\"tel\":false,\"email\":false,\"web\":false,\"desc\":false},\"visible\":1,\"lon\":\"-2.4871419408111706\",\"user_id\":4575,\"map_url\":\"26T9Te\",\"snazzy\":{\"id\":12,\"snazzy_id\":11,\"name\":\"Blue\",\"json\":\"[{\\\"featureType\\\":\\\"all\\\",\\\"stylers\\\":[{\\\"hue\\\":\\\"#0000b0\\\"},{\\\"invert_lightness\\\":\"true\"},{\\\"saturation\\\":-30}]}]\"}}"
subst = "\"$1\""
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html