From: Aaron Patterson Date: 2009-05-20T02:04:32+09:00 Subject: Re: Problem with Regular Expression On Wed, May 20, 2009 at 01:54:24AM +0900, Mario Ruiz wrote: > > I'm replacing a string using: > xmlString.gsub!(/:#{tagName}>#{oldValue}<\//i,":" + tagName + ">" + > value + " > It works perfectly but... if oldValue contains the character +, it > doesn't work. > > Do you know how to solve this? Use Regexp.escape(): xmlString.gsub!(/:#{tagName}>#{Regexp.escape(oldValue)}<\//i,":" + tagName + ">" + value + "