On 7 April 2010 10:58, Michael Pavling <[email protected]> wrote:
> On 7 April 2010 10:44, Hemant Bhargava <[email protected]> wrote:
>> I am having an string and i want all extra characters to be removed from
>> that string except + and .
>
> word.gsub(/[^+\.]/, "")
>

oh... if you want to keep alphanumeric characters:

word.gsub(/[^a-zA-Z0-9+\.]/, "")

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to