Help: Matching last character of a string!

Hi,

I am trying to replace the last character of a string with
another character:

x = “{Hello {hello}}”
x.sub!(/}$/, “]”)
puts x

With Ruby 1.8.5 (on Windows) this gives (as expected)
{Hello {hello}]

With Ruby 1.8.1 (on Linux) I get (surprisingly)
{Hello {hello}}

Who knows what is going on? Can’t believe a fundamental bug like
this was still in 1.8.1 …

Cheers
Uwe

Uwe Lammers wrote:

Who knows what is going on? Can’t believe a fundamental bug like
this was still in 1.8.1 …

Hi Uwe,

No idea what/why, but at least I can tell you
that it works as expected on 1.8.4 under Linux.

HM