in reply to Short URL?
If the url isn't too long then the regex won't match and it will remain unchanged. Otherwise an elipsis will replace the overflow characters in the middle.$url =~ s/^(.{35}).{3,}(.{15})$/$1...$2/;
Update: replaced an asterix with a plus so the elipsis will replace at least one character.
Update: changed the plus to {3,} and the 53 to 35. Thanks madhatter
-caedes
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Short URL?
by The Mad Hatter (Priest) on Apr 06, 2003 at 02:14 UTC | |
by bart (Canon) on Apr 06, 2003 at 10:46 UTC | |
by caedes (Pilgrim) on Apr 06, 2003 at 02:18 UTC |