From: Hassan Schroeder Date: 2008-08-13T23:23:13+09:00 Subject: Re: Regular expression: anything except 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, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com