fork download
  1. s = '11xx22xx33xxBEGINxx44xx55xxENDxx66xx77'
  2.  
  3. import re
  4. matches = re.findall('(?:^|xx)(BEGIN.*?END|.*?)(?=xx|$)', s)
  5. print matches
Success #stdin #stdout 0.01s 6684KB
stdin
Standard input is empty
stdout
['11', '22', '33', 'BEGINxx44xx55xxEND', '66', '77']