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
In reply to Re: Short URL?
by caedes
in thread Short URL?
by bobafifi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |