fork download
  1. import re
  2. s = "01 02 09 02 09 02 03 05 09 08 09 "
  3. m = re.search(r'01(?:\s\w{2})+\s09', s)
  4. if m:
  5. print( [x[::-1] for x in re.findall(r'(?=\b(90.*?10$))', m.group()[::-1])] )
Success #stdin #stdout 0.03s 9608KB
stdin
Standard input is empty
stdout
['01 02 09 02 09 02 03 05 09 08 09', '01 02 09 02 09 02 03 05 09', '01 02 09 02 09', '01 02 09']