my $maxlen = 35; s![?].*$!!; # chop query params if any s{^(.*)(?=/[^/]/?)}{length $1 < $maxlen ? $1 : substr($1, 0, $maxlen-3 +)."..."}e;
Makeshifts last the longest.
In reply to Re: Regex to Truncate URLs Nicely
by Aristotle
in thread Regex to Truncate URLs Nicely
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |