From: 7stud -- Date: 2009-04-19T16:59:52+09:00 Subject: Re: String replacing help Jeremy Woertink wrote: > The goal of what I'm trying to do is take a string and insert pipes '|' > before words that are *not* inside of . > Yet you were not able to provide an example of the desired result? > The words I'm trying to insert the pipe before have a non-breaking space > tags around them. Based on *my* interpretation of your description, I think this is what you want: result = str.gsub(/ ([^<]*) /m, ' |\1 ') -- Posted via http://www.ruby-forum.com/.