I have two arrays of strings, and I need to exclude elements from one that contain elements of the second.
strings = ["chairs are on sale today", "my dog likes bumblebees", "one bad apple", "most snow is green"]
nouns = ["chair", "stove", "apple"]
the ideal result would be an array (either new or modified strings) that contains
["my dog likes bumblebees", "most snow is green"]
If this were exact matches, I could use the built-in functions:
result = strings - nouns
but obviously that won't work here.
Is there a simple way to do this, using grep, select, or some other ruby function?
Thanks!