From: "dominique.plante@..." Date: 2006-07-22T05:15:09+09:00 Subject: Re: Newbie Question: delete all non alphanumeric characters for fun, I started irb, then typed "567576hgjhgjh&**)".gsub(/^[0-9a-z]/i, '') It returned 67576hgjhgjh&**) Tom Werner wrote: > Logan Capaldo wrote: > > > > On Jul 21, 2006, at 1:53 PM, Theallnighter Theallnighter wrote: > > > >> Hi all, > >> how can i delete all non alphanumeric characters in a string ? thanks > >> > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > > > > string.gsub(/[0-9a-z]+/i, '') > > > > > > > That deletes all alphanumeric. To delete all non-alphanumeric: > > string.gsub(/[^0-9a-z]/i, '') > > -- > Tom Werner > Helmets to Hardhats > Software Developer > tom@helmetstohardhats.org > www.helmetstohardhats.org