1# credit to Stack Overflow user in the source link
2# finds isolated alphabetical characters
3import re
4s = "fish oil B stack peanut c <b>"
5
6words = re.finditer('\S+', s)
7has_alpha = re.compile(r'[a-zA-Z]').search
8for word in words:
9 if len(word.group()) == 1 and has_alpha(word.group()):
10 print(word.start()) # prints the index inside the string