From: Nuralanur@... Date: 2006-06-29T02:11:27+09:00 Subject: Re: remove all illegal chars form string -------------------------------1151504351 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable For your specific example, you can do this,=20 =20 a=3D"_exam@p_ (mailto:exam@p) Le3|=A7" =20 a.gsub!(/[^A-Za-z0-9]/,'') p a =20 You can also eliminate elements you specify in an Array : =20 class Array def eliminate_chars_from_this_array(text) res=3Dself.dup res.each{|x| text.gsub!(Regexp.new(x),'') } return text end end =20 array=3D["a","@","\247","=E9","\'"] a=3D"_exam@p_ (mailto:exam@p) Le3|=A7=E9\247'" =20 a=3Darray.eliminate_chars_from_this_array(a) p a =20 Best regards, =20 Axel=20 -------------------------------1151504351--