From: matz@... (Yukihiro Matsumoto) Date: 2001-05-22T15:58:54+09:00 Subject: [ruby-talk:15530] Re: Perl's quotemeta in ruby Hi, In message "[ruby-talk:15526] Perl's quotemeta in ruby" on 01/05/22, Matt Armstrong writes: |1) Is this the best way to implement Perl's quotemeta in Ruby? Regexp::quote(s) |2) Is there an equivalent to quotemeta already built in? see above answer. |3) Ruby 1.4's CGI::escape is this: | Why not just this: | | def CGI::escape(string) | string.gsub(/[^a-zA-Z0-9_.-]/n){ sprintf("%%%02X", $&.unpack("C")[0]) } | end probably historical reason. matz.