From: Michael Linfield Date: 2009-03-16T03:21:53+09:00 Subject: Re: Why do I need \b in regular expression? Think of \b as the boundary of the words in a string. \B has the opposite effect, affecting all letter/character boundaries instead of whole words. string = "foo bar" if you gsub this using \b, it will look like this: string.gsub(/\b/,"-") #=> -foo- -bar- As you can tell, it has added a "-" to only the boundaries (edges) of each word. using \B will output this #=> f-o-o b-a-r These are the inside boundaries of each word instead of the outside boundaries. I hope this clarifies things a little. Regards, - Mac -- Posted via http://www.ruby-forum.com/.