[Catalyst] create search engine friendly uri from string

Jim Spath jspath at pangeamedia.com
Mon Dec 15 20:22:12 GMT 2008


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 <onken at houseofdesign.de 
> <mailto:onken at 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



More information about the Catalyst mailing list