On Dec 22, 2008, at 11:09 AM, elioncho wrote:
> Hello,
>
> I am trying to apply a gsub! to a string. I want to know how to make
> the pattern evaluate that everything that IS NOT numbers, letters or
> commas should be replaced with ""(nil). Any ideas in how to do this
> pattern?

/[^[:alnum:],]/

[^ ] - is a negated character class
[:alnum:] - is the POSIX character class for alphanumerics
, - is a comma ;-)

> Thanks a lot,
>
> ElĂ­as


Since you have an accented character in you name, I'm assuming that  
the [:alnum:] class is better than just a-zA-Z0-9 since it should  
encompass the accented characters, too.

-Rob

Rob Biedenharn          http://agileconsultingllc.com
[email protected]


--~--~---------~--~----~------------~-------~--~----~
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