> > |Does the new Ruby regexp engine do this? > | > | irb(main):001:0> '1234'.scan(/(1)(2)|(3)(4)/) > | => [["1", "2", nil, nil], [nil, nil, "3", "4"]] > | irb(main):002:0> > | > |Why would all the subexpressions be listed when there is an `|` (or) used? I > |expected: > | > | => [["1", "2"], ["3", "4"]] > > You will never know which subexpression is matched, if you get your > expected result. Is there any reason /(1|3)(2|4)/ is not sufficient? This matches 14 and 32 too. /(1(?=2)|3(?=4)(2|4)/ is better but more complex and generally hard to do. Peter