This question has an answer here but I can't seem to be able to adopt it to my use case.
I want to match to a string that contains the word "reset" but not password. For example suppose I have the following two:
queries = ["reset my password", "reset my account please.", "password reset"]
for q in queries:
print(is_reset(q))
should output False, True, False
where is_reset
would contain the regex.
The regex that I tried was:
matches = re.search("(?=reset)(?!.*password)", text)
if matches:
print("Matched")
else:
print("No match")
The above seems to have an issue with the last query. Also I am blindly copying the regex, couls someone explain what the regex above/ answer means?