T., > 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? For collecting matches, Ruby simply looks at opening parenthesis - nothing else. The part of the string matched by the regular expression delimited by the first open parenthesis and its matching close parenthesis will be the first match, the second opening parenthesis and its matching close parenthesis will define the next match, etc. I have not yet had an opportunity to play with Oniguruma, so I can't say definitively if behaves the same way. However I would be very surprised if it didn't, since virtually every other language behaves this way. I hope this helps. - Warren Brown