I have been spending time on this regex but I can't get it to work. So I need to match bunch of words in a phrase but if the same word occurs with a set of words, I do not want that to be captured. For example:
phrase: Hi, I am talking about a recall on the product I bought last month. If I recall correctly, I purchased this at your store on august 15th. Can you tell me if I can get a refund on this recall?
Result should match the first recall and the last recall. but it should not match 'If I recall' since those three words together doesn't talk about the product recall.
I tried different variations of this but couldn't get it to work. This matches all 'recall' terms.
(?<!If\sI\srecall).*?(recalls?|recalled).*?(?!If\sI\srecall)
I am using Python 3.10 to test this. Any help would be appreciated.