I was wondering if it\'s possible to use regex with python to capture a word, or a part of the word (if it\'s at the end of the string).
Eg: target word - potato
import re patt = re.compile(r'(p|po|pot|pota|potat|potato)$') patt.search(string)
I was tempted to use r'po?t?a?t?o?$', but that would also match poto or pott.
r'po?t?a?t?o?$'