From: David Pollak Date: 2006-06-29T02:18:01+09:00 Subject: Re: remove all illegal chars form string ------=_Part_66952_322716.1151511658781 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thomas, s =3D "exam@p Le3|=A7" s.gsub(/[^a-zA-Z0-9]/, '') # =3D> "exampLe" Thanks, David On 6/28/06, thomas coopman wrote: > > Hi, > > Is there a simple way to remove all but the legal chars from a > string. where the legal chars are for example: a-z A-Z 0-9 > So everything should be removed from the string but these characters. > "exam@p Le3|=A7" --> "exampLe" > > I don't know very much about regular expressions, so I don't know if it's > possible with sub or gsub. My first Idea was to loop over the string and > check every character but I wondered if there is something more simple or > better. > > Thanks > > --=20 -------- David Pollak's Ruby Playground http://dppruby.com ------=_Part_66952_322716.1151511658781--