[#2748] Proposal: New Bignum — "Evan Webb" <evan@...>
During some experiments with ruby cryptography, I found some problems with
11 messages
2004/04/06
[#2749] Re: Proposal: New Bignum
— matz@... (Yukihiro Matsumoto)
2004/04/06
Hi,
[#2764] RDoc :enddoc: — Tanaka Akira <akr@...17n.org>
I found that RDoc document some method after :enddoc:. Is it
7 messages
2004/04/10
[#2788] Problems building ext/io/wait.c in 1.8 branch — Gavin Sinclair <gsinclair@...>
I can't get io/wait installed. The main problem is that it doesn't
6 messages
2004/04/17
[#2799] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Saturday, April 17, 2004, 4:42:14 PM, Gavin wrote:
[#2800] Re: Problems building ext/io/wait.c in 1.8 branch
— ts <decoux@...>
2004/04/21
>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
[#2801] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Thursday, April 22, 2004, 1:21:29 AM, ts wrote:
[#2805] Bug 1318 — Steven Jenkins <steven.jenkins@...>
Any comments on
9 messages
2004/04/23
[#2814] Tempfile strangeness in 1.9.0 — Steven Jenkins <steven.jenkins@...>
I didn't open a bug for this because it's from the CVS head, but it
5 messages
2004/04/24
Re: Problems with gsub, double quoted strings
From:
george.marrows@...
Date:
2004-04-14 07:47:56 UTC
List:
ruby-core #2784
> Opening a fresh irb session (using Ruby 1.8.1 on OSX) I have the following
> problem with gsub:
> irb(main):001:0> name = "new_name"
> => "new_name"
> irb(main):002:0> ' self->hey '.gsub(/(\W)self(\W)/, "#{$1}#{name}#{$2}")
> => "new_name>hey "
> irb(main):003:0> ' self->hey '.gsub(/(\W)self(\W)/, "#{$1}#{name}#{$2}")
> => " new_name->hey "
>
> Putting the following into a text file and feeding it to Ruby I get the
> same result.
> #!/usr/local/bin/ruby
> name = 'new_name'
> str = ' self->hey '
> puts str.gsub(/(\W)self(\W)/, "#{$1}#{name}#{$2}")
> puts str.gsub(/(\W)self(\W)/, "#{$1}#{name}#{$2}")
>
> ####### output is:
> new_name>hey
> new_name->hey
> ####### end of output
>
> Seems like $1 and $2 are nil the first time.A
Hi Charlie --
In the examples above, $1 and $2 are evaluated before the call to gsub even
gets going, and not on each match. Use \1 etc in the string, or pass in a
block.
See eg http://www.ruby-talk.org/blade/88377 and following thread.
-- George