Forum: Ruby on Rails Remove special characters from sentence

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4ab2692ba129cb296d4f2e90ba5241da?d=identicon&s=25 Sandip Ransing (san2821)
on 2009-06-08 07:50
(Received via mailing list)
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
http://sandip.sosblog.com
http://funonrails.wordpress.com
www.joshsoftware.com
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-06-08 09:50
(teststring.gsub(/[^a-zA-Z 0-9]/, "")).gsub(/\s/,'-')

Sijo
4ab2692ba129cb296d4f2e90ba5241da?d=identicon&s=25 Sandip Ransing (san2821)
on 2009-06-08 11:24
(Received via mailing list)
Thanks Sijo !

On Mon, Jun 8, 2009 at 1:20 PM, Sijo Kg
<rails-mailing-list@andreas-s.net>wrote:

>
>
> (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
This topic is locked and can not be replied to.