import re
regex = re.compile(r"(?sU)(?=\{[^}]*:1017).*:\"(.*)\"")
test_str = "{\"wvw_matches\":[{\"wvw_match_id\":\"2-1\",\"red_world_id\":2202,\"blue_world_id\":2101,\"green_world_id\":2201,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-6\",\"red_world_id\":2206,\"blue_world_id\":2207,\"green_world_id\":2205,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-2\",\"red_world_id\":2104,\"blue_world_id\":2010,\"green_world_id\":2003,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-3\",\"red_world_id\":2301,\"blue_world_id\":2002,\"green_world_id\":2012,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-7\",\"red_world_id\":2105,\"blue_world_id\":2011,\"green_world_id\":2005,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-4\",\"red_world_id\":2203,\"blue_world_id\":2103,\"green_world_id\":2007,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-5\",\"red_world_id\":2014,\"blue_world_id\":2204,\"green_world_id\":2013,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-9\",\"red_world_id\":2004,\"blue_world_id\":2006,\"green_world_id\":2102,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"2-8\",\"red_world_id\":2008,\"blue_world_id\":2001,\"green_world_id\":2009,\"start_time\":\"2015-10-16T18:00:00Z\",\"end_time\":\"2015-10-23T18:00:00Z\"},{\"wvw_match_id\":\"1-1\",\"red_world_id\":1003,\"blue_world_id\":1008,\"green_world_id\":1019,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-2\",\"red_world_id\":1009,\"blue_world_id\":1016,\"green_world_id\":1017,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-3\",\"red_world_id\":1014,\"blue_world_id\":1011,\"green_world_id\":1005,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-4\",\"red_world_id\":1012,\"blue_world_id\":1010,\"green_world_id\":1021,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-5\",\"red_world_id\":1002,\"blue_world_id\":1004,\"green_world_id\":1018,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-6\",\"red_world_id\":1001,\"blue_world_id\":1013,\"green_world_id\":1006,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-7\",\"red_world_id\":1022,\"blue_world_id\":1015,\"green_world_id\":1007,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"},{\"wvw_match_id\":\"1-8\",\"red_world_id\":1024,\"blue_world_id\":1023,\"green_world_id\":1020,\"start_time\":\"2015-10-17T01:00:00Z\",\"end_time\":\"2015-10-24T01:00:00Z\"}]}"
match = regex.search(test_str)
if match:
print(f"Match was found at {match.start()}-{match.end()}: {match.group()}")
for group_num, group in enumerate(match.groups(), start=1):
print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")
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