You might also want to add these two to the end:
=~ s/--+/-/g;
=~ s/-$//g;
Scott McWhirter wrote:
$str =~ s{\W}{}g;
$str = lc($str);
$str =~ s{\s+}{-}g;
--
-Scott McWhirter- | -konobi-
On Mon, Dec 15, 2008 at 12:10, Moritz Onken <on...@houseofdesign.de
<mailto:on...@houseofdesign.de>> wrote:
Hi,
I was wondering if anyone has a nice regex or module which modifies
a string to look good in an url.
You know this behaviour from blogs which make urls from the blog title
Example: "Beta Launch Invites: Kwyno Brings The Web Into Your IM And
(Soon) SMS Inboxes" ->
http://www.techcrunch.com/2008/12/15/beta-launch-invites-kwyno-brings-the-web-into-your-im-and-soon-sms-inboxes/
Any ideas?
cheers,
moritz
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/