fork download
  1. import re
  2. texts = ['Refer to Annex 1.1, 1.2 and 2.0 containing information etc,', 'Refer to Annex 1.0.1, 1.1.1 containing information etc,']
  3. rx = re.compile(r'Annex\s*(\d+(?:(?:\W|and)+\d)*)')
  4. for text in texts:
  5. match = rx.search(text)
  6. if match:
  7. print(re.findall(r'\d+(?:\.\d+)*', match.group(1)) )
Success #stdin #stdout 0.03s 9408KB
stdin
Standard input is empty
stdout
['1.1', '1.2', '2.0']
['1.0.1', '1.1.1']