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
Use the $ to match at the end of a string. For example, the following would match 'potato' only at the end of a string (first example):
$
"potato$"
This would match all of your examples:
"pota[to]{1,2}$"
However, some risk of also matching "potao" or "potaot".