Remove special characters from sentence


#1

Hi All,

What is regular expression to remove special chars from a sentence and
replace spaces with hypen ??

Thanks,
Sandip R~

Ruby on Rails Developer



www.joshsoftware.com


#2

(teststring.gsub(/[^a-zA-Z 0-9]/, “”)).gsub(/\s/,’-’)

Sijo


#3

Thanks Sijo !

On Mon, Jun 8, 2009 at 1:20 PM, Sijo Kg
removed_email_address@domain.invalidwrote:

(teststring.gsub(/[^a-zA-Z 0-9]/, “”)).gsub(/\s/,’-’)

Sijo

Posted via http://www.ruby-forum.com/.


Ruby on Rails Developer
http://sandip.sosblog.com
http://funonrails.wordpress.com
www.joshsoftware.com