From: Gunther Gunt Date: 2008-08-13T23:34:45+09:00 Subject: Re: Regular expression: anything except Hassan Schroeder wrote: > On Wed, Aug 13, 2008 at 7:10 AM, Gunther Gunt > wrote: > >> I am trying to create a regular expression with the following rule: >> >> my text is: >> blabla >> I want to replace with something >> >> "".gsub(/the magic regular expression/,"replacement") >> ==> replacementblabla > > This example isn't consistent with the following ones -- do you > want the ending inserted even if it's not in the original > string? > >> but i want also that >> "blabla".gsub(/the magic regular expression/,"replacement") >> returns the same result >> ==> replacementblabla >> >> and >> blabla".gsub(/the magic regular >> expression/,"replacement") >> returns the same result >> ==> replacementblabla > > Assuming the second two are actually what you want, try > > "blabla".gsub(/]*>/, 'replacement') > > HTH, I had just found the solution, and I was posting it. Thank you anyway ;o) Gunther -- Posted via http://www.ruby-forum.com/.