From: 7stud -- Date: 2009-04-20T00:58:14+09:00 Subject: Re: String replacing help Jeremy Woertink wrote: > 7stud -- wrote: >> 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? > > I'll try what you have, but here is what the desired result > > HEAD > TITLE "test" > BODY > DIV |id "main-div" > CSS-WITH-LINK |destination TO :index > IMAGE |source RENDER |image @image > > Ok. Here's the deal. When asking these types of question, you need to post two things: 1) The starting string. 2) The result string. Apparently, you want to know what regex will transform this string: "
HEAD \n  TITLE \"test\"\nBODY \n
DIV id \"main-div\"\n
CSS-WITH-LINK destination TO :index\n
IMAGE source RENDER image @image\n
max-height m-h\n
" into this string: "HEAD TITLE "test" BODY DIV |id "main-div" CSS-WITH-LINK |destination TO :index IMAGE |source RENDER |image @image" Good luck with that. -- Posted via http://www.ruby-forum.com/.