On Thu, Dec 19, 2002 at 06:38:16PM +0900, Greg Millam wrote:
> My bad - need to escape those.
> 
> \\1 and \\2
> 
> irb(main):032:0> ": dbl dup + ;".gsub(%r[(\s|^)\+(\s|$)], %Q[\\1:plus:\\2])

Thanks much. Now it works

def mangle(s, dict)
    dict.each_pair do |key,id|
	word = Regexp.quote(key)
	s.gsub!(%r[(\s|^)#{word}(\s|$)], %Q[\\1<xref linkend="#{id}"/>\\2])
	s.gsub!(%r[(\s|^)#{word}(\s|$)], %Q[\\1<xref linkend="#{id}"/>\\2])
    end
    s
end

-- 
Radek Hnilica <Radek at Hnilica dot CZ>
=======================================
No matter how far down the wrong road you've gone, turn back.
						Turkish proverb