From: Pit Capitain Date: 2005-08-15T15:11:51+09:00 Subject: Re: utf8 string with reverse question Mitch Tishmack schrieb: > In short I see this behavior: > > "Stuhlu".sub(/u/,'�') > => "St�hlu" > "Stuhlu".reverse.sub(/u/,'�').reverse > => "Stuhl\274\303" > "Stuhlu".reverse.sub(/u/,'�').split(//).reverse.join > => "Stuhl�" > > The general goal is to sub the final "u" in that word with an umlauted > version and not the first. > ... > Am I mising a > Regexp option that would make the final match work? Can't help with the reverse behaviour, but if you want to substitute single letters only the following regexp should work: "Stuhlu".sub(/u(?=[^u]*$)/,'�') Regards, Pit