From: Reimer Behrends Date: 2003-01-27T19:17:15+09:00 Subject: Re: Very nasty piece of code Peter Hickman (peter@semantico.com) wrote: [...] > while string =~ /(&#([0-9a-fA-F]{2});)/ do > # Converting from &#XX; to \'XX > > string.sub!($1, "\\\\\\\''#{$2}") > end string.gsub!(/&#[0-9a-fA-F]{2};/) {|x| "\\'#{x[2,2]}" } is faster (your code has quadratic complexity) and a bit more concise. Reimer Behrends