i have 2 arrays:
a = ["x2", "x3/x4", "x5/x6/x7", "x8/x9/x10/x11"] b = ["x9/x10", "x3/x4"]
now need select entries 'a' array regexp of entries array 'b'.
expected result is:
["x3/x4", "x8/x9/x10/x11"]
how can in ruby?
i'd do:
a.grep(regexp.union(b)) # => ["x3/x4", "x8/x9/x10/x11"]
Comments
Post a Comment