Hello, looking for some help from Regex experts
I am doing some text analysis..
It is partially working, but I end up with some contradictions and repetitions.. e.g. NOT DOG, DOG-PRESENT, or NOT CAT, CAT-PRESENT, CAT-PRESENT.
The -PRESENT ones are better quality than the 'NOTS' so these should overrule them
I need a Regex that removes repetitions, and looks for the key word (DOG or CAT) and if -PRESENT is there, removes the NOT [KEYWORD].
Is this possible?
Hi @chickenlicken
Can you provide some expected output It will help us get a better understanding of the usecase.
We will be happy to help : )
So input would be NOT CAT, CAT-PRESENT, CAT-PRESENT
and output would be
CAT-PRESENT
Thank you, these both look like great solutions and mega quick !
Is there a way I could adjust it so that it also works where the phrases aren't in this exact order?
Input could be:
NOT CAT, CAT-PRESENT, CAT-PRESENT
And also
CAT-PRESENT, NOT CAT
My solution should work for any order.
And you allowed to mark more than one posts as solution so feel free 🙂
Hope this helps : )
Ah nearly but not quite there yet - it's complicated because there are lots of versions of these "animals", so if there is e.g.
NOT DOG, DOG-PRESENT, CAT-PRESENT, NOT CAT, MOUSE-PRESENT then it messes it up
How about if i change the inputs to CAT-YES, CAT-NO, DOG-YES, DOG no, etc... and then split the records multiple times....?
I was wondering if a Regex that looked for the matching first component would be easier...