regex find a word index of all matches
snippet in assembly

regex find a word index of all matches

user6727

import re
sentence = input("Give me a sentence ")
word = input("What word would you like to find ")
for match in re.finditer(word, sentence):
    print (match.start(), match.end())