I've been trying to come up with a way to search for the exact match of one word (as a string) within another string.
So, for example, if I were searching for the string, 'eligible', searching it against the string 'ineligible' would not yield a result.
Here is the code I have thus far:
Code:
def findstring(string1, string2): if re.search(r'(^|[^a-z0-9])'+re.escape(string1)+r'($|[^a-z0-9])',
Leave a comment: