does anybody knows why I am getting different results depending on the order of the patterns?
list1 = ["AA1", "AA2","AA", "AA+"]
list2 = ["AA1", "AA2","AA+", "AA"]
results1 = "somethin with AA+ in it".scan(Regexp.union(list1))
results2 = "somethin with AA+ in it".scan(Regexp.union(list2))
Results1 outputs "AA" Results2 outputs "AA+"
I may be misunderstandig how scan works, but I was expecting it to return every occurrence, hence both "AA" and "AA+". Also I don't get why the ouptut changes depending on the order of the strings used.