fork(1) download
  1. import re
  2. s = "These are the words in a sentence"
  3. regex = re.compile('words|are|in|a|e')
  4. print([(re.findall(regex,s)[i], m.start(0)) for i,m in enumerate(re.finditer(regex,s))])
Success #stdin #stdout 0.02s 9944KB
stdin
Standard input is empty
stdout
[('e', 2), ('e', 4), ('are', 6), ('e', 12), ('words', 14), ('in', 20), ('a', 23), ('e', 26), ('e', 29), ('e', 32)]