in reply to Re: Re: Short URL?
in thread Short URL?
The updated regex works unless the URL is exactly 53 characters long. In that case I believe bobafifi wants the URL to stay the sameIn that case, the ".{3,}" in caedes' code should become ".{4,}". Indeed, I see no reason to replace the correct string of 3 characters, by 3 dots. The code would become:
I would be tempted to throw in a "?" to reduce the greediness of the middle subppatern, but it wouldn't help one bit, here.$url =~ s/^(.{35}).{4,}(.{15})$/$1...$2/;
|
|---|