in reply to Regex to Truncate URLs Nicely

How about something like this?

$url =~ s!^(https?://.*?/)(?:.{20}.*)?(/[^?]*)(\?.*)*!$1(..)$2!
Works on urls with or without args on the end, the 20 in the middle can be adjusted to fit whatever url you mostly encounter.

Best Regards,
Wonko