import rerx = r"field3:(.*?)(?=field\d+:|$)"s = "field1:afield3:b and morefield2:cfield3:d and here"res = re.findall(rx, s)print(res)
Standard input is empty
['b and more', 'd and here']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!