I have a category column that is separated by ";". I.E Value:
value <- "A > B > C; A > B > D; A > B > C > C1"
It means:
The current product belongs to category "A > B > C", to category "A > B > D" and to category "A > B > C > C1"
If a category is already contained in another, this should be removed. So the goal is:
expectedResult <- "A > B > D; A > B > C > C1"
because "A > B > C > C1" is containing "A > B > C".
How can I solve this?
Note: I know that there are hundreds of questions that seem similar. But I just couldn't find a solution.
This ought to work:
Output: