import rep = re.compile(r'(?=(\d+(?<!\\)\'))')test_str = input()print(re.findall(p, test_str))
sasi0'sada1\'adad2'theend
["0'", "2'"]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!