Suppose I have the following two lists:
l1 = {{"apple", "banana", "cream"}, {"beef", "pepper",
"salt"}, {"wine", "beer", "beef", "olive"}}
l2 = {"beef:salt:pepper", "apple:cream", "wine:beer:beef:olive"}
For each element in l2
I want to go through l1
and select the element in l2
if it exists in l1
, such that the output would be:
{"beef:salt:pepper", "wine:beer:beef:olive"}
I know generally one should use Intersection[l1, l2]
yet the format of two lists are different so it turns an empty list. I wonder how one go around this?