From: "NARUSE, Yui" Date: 2008-03-05T02:37:42+09:00 Subject: Re: Named captures and regular captures Dave Thomas wrote: > It seems that once you have a named capture in a regular expression, you > can no longer use numeric captures. > > m = /(.)(.)(?\d+)(\d)/.match("THX1138.") > m.begin(:digit_prefix) > m.begin(2) #=> index 2 out of matches > > $1 #=> 113 > $2 #=> nil > > m.to_a #=> => ["HX1138", "113"] > > > Is this expected? Yes, expected. http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt In Ruby ONIG_OPTION_DONT_CAPTURE_GROUP is on. This is because there are few cases when both named capture and number capture are required. -- NARUSE, Yui DBDB A476 FDBD 9450 02CD 0EFC BCE3 C388 472E C1EA