Sandeep Gudibanda
2008-Jul-23 06:54 UTC
gsub all character except alphanum and character "&''
Hi, I want to replace all the special characters in my string except ''&'' with ''-''. How do i do that? I am currently using gsub(/[^[:alnum:]]/,''-'') But how do i say except ''&''? Please suggest. Regards, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pardee, Roy
2008-Jul-23 16:15 UTC
Re: gsub all character except alphanum and character "&''
Try: gsub(/[^[:alnum:]&]/,''-'') -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Sandeep Gudibanda Sent: Tuesday, July 22, 2008 11:54 PM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] gsub all character except alphanum and character "&'' Hi, I want to replace all the special characters in my string except ''&'' with ''-''. How do i do that? I am currently using gsub(/[^[:alnum:]]/,''-'') But how do i say except ''&''? Please suggest. Regards, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---