From: Paul Battley Date: 2006-06-29T02:11:50+09:00 Subject: Re: remove all illegal chars form string On 28/06/06, thomas coopman wrote:> 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|則" --> "exampLe" Yes, there is: str = "exam@p Le3|則"str.gsub(/[^a-z0-9]/i, '') # => "exampLe3" Paul.