Hi,
“\000”.gsub("\000") { “\000” }
=> “\000”
“\000”.gsub("\000", “\000”)
=> “\00000”
I expected both to return the same result.
Just tell me it’s not a bug and I’m happy
Regards,
Michael
Hi,
“\000”.gsub("\000") { “\000” }
“\000”.gsub("\000", “\000”)
I expected both to return the same result.
Just tell me it’s not a bug and I’m happy
Regards,
Michael
Just tell me it's not a bug and I'm happy
This is not a bug
svg% ruby -e 'p "\000".gsub("\000", "\\&00")'
"\00000"
svg%
Guy Decoux
Not a bug
When used in an argument rather than in a block, \0 inserts the matched
string. So gsub(“\000”, “\000”) is really saying “replace any null
characters with themselves followed by two zeros”.
The block form does not interpolate backslashed matches.
cheers,
–Mark
On Apr 24, 2004, at 10:10 AM, Michael Neumann wrote:
Hi,
“\000”.gsub(“\000”) { “\000” }
=> “\000”
“\000”.gsub(“\000”, “\000”)
=> “\00000”
I expected both to return the same result.
Just tell me it’s not a bug and I’m happy