Hi -- On Thu, 25 Aug 2005, Jeff Wood wrote: > Regarding nil values for groups > > if you define your regular expressions like this : > > a = "My phone number is : 555-1212" > b = /((\d{3})\-)?(\d{3})\-(\d{4})/ > c = b.match( a ) > puts c.to_a > > c should be [ "555-1212", nil, nil, "555", "1212" ] Oh, well, yes -- if there's no match for the group. I was taking you very literally: >>> Remember that if you define a group to be >>> inside an optional region of the regular expression, that group will >>> return nil. You didn't include the "if there's no match" bit :-) David -- David A. Black dblack / wobblini.net