On 18.03.2007 12:40, J. mp wrote:
> Hi again, I'm allways here to ask how to use regular expressions.
> what I want now is to replace chars from a string with empty spaces
> 
> sample = "thi's is a tes<>%$#!|t"
> 
> what I want is use sample.sub(\['<>%$#!|]\,"")
> and the outcome shoudl be
> 
> "this is a test"
> 
> But I only can replace the first occurence of the chars specified in the
> reg exp
> 
> How can I replace all occurences?

You can find it in the docs: http://ruby-doc.org/

Hint: There are sub, sub!, gsub and gsub!.

Kind regards

	robert