On Jun 16, 9:06 pm, jmb-d <jon.budardan... / gmail.com> wrote: > Is it possible to redefine (temporarily) the meaning of \b in RegExp > situations? I think the only way to do this would be to redefine all the circumstances in which a \b could occur yourself. For instance the 6 cases that I can think of are: ^\w, \W\w, \s\w, \w$, \w\W, \w\s. This is a pain as you can see here I've done four and it's very ugly: >"ABCD.E foo FG.HI".gsub(/^(\w)/, "'\\1").gsub(/(\w)$/, "\\1'").gsub(/(\w)(\s)/, "\\1'\\2").gsub(/(\s)(\w)/, "\\1'\\2") => "'ABCD.E' 'foo' 'FG.HI'" Alternatively you could pre and post process by replacing "." with something that doesn't break the boundary "zyzyzy" and then replace back with "." when you're done inserting the ticks: > "ABCD.E foo FG.HI".gsub(/\./, "zyzyzy").gsub(/\b/, "'").gsub(/zyzyzy/, ".") => "'ABCD.E' 'foo' 'FG.HI'" Neither are very nice solutions. - Byron ----- http://www.saltylabs.com/