Article View: pl.comp.lang.ruby
Article #159Re: Problem z '
From: janu
Date: Fri, 25 Aug 2006 16:24
Date: Fri, 25 Aug 2006 16:24
21 lines
1869 bytes
1869 bytes
Marcin Mielżyński wrote:
> puts "'wishes'".gsub("'","\\\\'")
> lub:
> puts "'wishes'".gsub("'"){'\\\''}
>
> z:
>
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/90404?help-en
>
>
> "It does look a bit odd, but the explanation is logical: There are two
> levels of escaping involved. The first level is that needed for the
> ruby parser to get the expected characters into the replacement string. The
> second level is used in order to be able to use a backslash literally in
> the substitution string"
Rzeczywiscie, pomoglo, dzieki wielkie. Sobie wlasnie przypomnialem, ze
o tym chyba pisali w Programming Ruby - the pragmatic costam ;)...
Pozdrawiam
Jachu
Technical Details
Message-ID:
<1156523048.715215.174890@m73g2000cwd.googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mailReferences:
<1156512904.344369.228030@75g2000cwc.googlegroups.com> <ecn29a$jp9$1@news.onet.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail From: "janu" <jachuf@gmail.com> Newsgroups: pl.comp.lang.ruby Subject: Re: Problem z ' Date: 25 Aug 2006 09:24:08 -0700 Organization: http://groups.google.com Lines: 23 Message-ID: <1156523048.715215.174890@m73g2000cwd.googlegroups.com> References: <1156512904.344369.228030@75g2000cwc.googlegroups.com> <ecn29a$jp9$1@news.onet.pl> NNTP-Posting-Host: 83.238.70.51 Mime-Version: 1.0 X-Trace: posting.google.com 1156523054 15537 127.0.0.1 (25 Aug 2006 16:24:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 25 Aug 2006 16:24:14 +0000 (UTC) In-Reply-To: <ecn29a$jp9$1@news.onet.pl> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060731 Firefox/1.5.0.5 Flock/0.7.4.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m73g2000cwd.googlegroups.com; posting-host=83.238.70.51; posting-account=ntEVaA0AAACC2OAaQ6hrHjnbG9iwpJgc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit