From: Josh Cheek Date: 2009-09-03T01:37:26+09:00 Subject: Re: Reg Ex exclusion --000e0cd24394de3e4104729ac16b Content-Type: text/plain; charset=ISO-8859-1 Use sub or sub! "joe|blogg|clothing|".sub(/\|$/,'') On Wed, Sep 2, 2009 at 11:17 AM, Ne Scripter < stuart.clarke@northumbria.ac.uk> wrote: > Hi all, > > I thought this would be easy, but I am clearly mixing up my logic. I > have a string like so > > string = "joe|blogg|clothing|" > > I want to remove the last pipe with a reg ex and I am trying to use the > following code to do so: > > string(/\|$/, 1) > > This however is not doing anything except delete the entire string, any > suggestion are greatly appreciated. > > Many thanks > -- > Posted via http://www.ruby-forum.com/. > > --000e0cd24394de3e4104729ac16b--