For your specific example, you can do this,
a=“[email protected] (mailto:[email protected]) Le3|§”
a.gsub!(/[^A-Za-z0-9]/,’’)
p a
You can also eliminate elements you specify in an Array :
class Array
def eliminate_chars_from_this_array(text)
res=self.dup
res.each{|x| text.gsub!(Regexp.new(x),’’) }
return text
end
end
array=[“a”,"@","\247",“é”,"’"]
a=“[email protected] (mailto:[email protected]) Le3|§é\247’”
a=array.eliminate_chars_from_this_array(a)
p a
Best regards,
Axel