Forum: Rails Spinoffs (closed, excessive spam) Help with gsub

54c4985debe9ede54b95597ada6532fa?d=identicon&s=25 louis w (Guest)
on 2008-06-12 23:13
(Received via mailing list)
Ok I will admit I suck at making regex patterns.

I want to transform the value to be all lowercase, _ instead of
spaces, and no special chars. (Basically a websafe filename). Here is
what I have. It works all except stripping out special chars.

Any help would be great.

    v = v.toLowerCase();
    v = v.gsub(' ', '_');
    v = v.gsub('/[^a-z0-9\s]/i', '');
8c5868aade15ca78a6b4dcdf3cc59bf7?d=identicon&s=25 blechler (Guest)
on 2008-06-12 23:30
(Received via mailing list)
v = v.gsub(/[^a-z0-9\s]/i, '');
8c5868aade15ca78a6b4dcdf3cc59bf7?d=identicon&s=25 blechler (Guest)
on 2008-06-12 23:31
(Received via mailing list)
v = v.gsub(/[^a-z0-9\s]/i, '');
54c4985debe9ede54b95597ada6532fa?d=identicon&s=25 louis w (Guest)
on 2008-06-12 23:54
(Received via mailing list)
Thanks!
This topic is locked and can not be replied to.