まつもと ゆきひろです In message "[ruby-list:15494] /^(.*)$/ in regexp" on 99/07/17, "NAKAMURA, Hiroshi" <nakahiro / sarion.co.jp> writes: |gsubで/^(.*)$/をマッチさせてみたんですが,1.2.6と1.3.5で, | |0% ruby-1.3.5 -ve '"a\n\nb\n".gsub( /^(.*)$/ ) { p $1 }' |ruby 1.3.5 (1999-07-15) [sparc-solaris2.5.1] |"a" |"b" | |0% ruby-1.2.6 -ve '"a\n\nb\n".gsub( /^(.*)$/ ) { p $1 }' |ruby 1.2.6(99/07/15) [sparc-solaris2.5.1] |"a" |"" |"b" | |と,なりました.後者だと嬉しいような気がしますが, |何か変更があったのでしたっけ? 青山さんの推測の通りバグでした。パッチも付けておきます。 --- regex.c 1999/07/15 07:59:52 1.1.1.3.2.27 +++ regex.c 1999/07/19 08:26:30 @@ -2747,4 +2747,7 @@ /* Don't return; check the alternative paths so we can set can_be_null if appropriate. */ + if ((enum regexpcode)p[-1] == anychar_repeat) { + continue; + } break;