Given an array of strings,
array1 = ["abcdwillbegoneabcccc","cdefwilbegokkkabcdc"]
and another array of strings that consist of patterns, for example. ["abcd","beg[o|p]n","bcc","cdef","h*gxwy"]
the task is to remove the substrings that match any line of the pattern. for example, the sample for this case should be:
["willbegonea","wilbegokkk"]
because we removed substrings (prematch or postmatch as appropriate depending on the appearance position) that matched one of the patterns. Suppose that one or two matches will always occur at the beginning or at the end of each row in array 1.
Any ideas for an elegant solution above in ruby?
source share