in reply to Regex to Truncate URLs Nicely
my $maxlen = 35; s![?].*$!!; # chop query params if any s{^(.*)(?=/[^/]/?)}{length $1 < $maxlen ? $1 : substr($1, 0, $maxlen-3 +)."..."}e;
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex to Truncate URLs Nicely
by Cody Pendant (Prior) on Nov 02, 2002 at 11:05 UTC | |
by Aristotle (Chancellor) on Nov 02, 2002 at 11:42 UTC |