わたなべさん、おはようございます。 >>[ruby-list:4841] Re: cgi-lib.rb >>From: WATANABE Hirofumi <watanabe / ase.ptg.sony.co.jp> >> >>ruby 1.1 から使えるようになります. はい。ruby 1.1 に期待して ruby-dev も読むようにしました。 >>\1, \2,... は String のところに説明があります. 注意すべき点 >>としては "\1" では 8 進数とみなされるので "\\1" か '\1' と書 >>きます. そうなんですか。ちょっと違和感ありますね。間違えそう。 マニュアルでも文法の所では次のようになっていますし。 >>シングルクォートで囲まれた文字列では,\\(バックスラッシュそのもの)と >>\'(シングルクォート)を除いて文字列の中身の解釈は行われません. >>さらに $1 は iterator の中じゃないとまずいです. この >>あたりが perl と違うところです. こちらはすでに引っ掛かってしまいました。shellwords.rb は直さなければ。 置換文字列として使う場合には、\1 を使うかイテレータの中に入れろという 事ですね。 ということで、また修正差分です。よろしくお願いします。 *** shellwords.rb.org Tue Oct 07 05:36:59 1997 --- shellwords.rb Thu Oct 09 06:59:35 1997 *************** *** 14,26 **** while TRUE if line.sub! /^"(([^"\\]|\\.)*)"/, '' then snippet = $1 ! snippet.gsub! /\\(.)/, $1 elsif line =~ /^"/ then STDOUT.print "Unmatched double quote: $_\n" exit elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then snippet = $1 ! snippet.gsub! /\\(.)/, $1 elsif line =~ /^'/ then STDOUT.print "Unmatched single quote: $_\n" exit --- 14,26 ---- while TRUE if line.sub! /^"(([^"\\]|\\.)*)"/, '' then snippet = $1 ! snippet.gsub! /\\(.)/, '\1' elsif line =~ /^"/ then STDOUT.print "Unmatched double quote: $_\n" exit elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then snippet = $1 ! snippet.gsub! /\\(.)/, '\1' elsif line =~ /^'/ then STDOUT.print "Unmatched single quote: $_\n" exit 青山 和光 Wakou Aoyama <pxn11625 / niftyserve.or.jp>