On 28/06/06, thomas coopman <thomas.coopman / gmail.com> 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.