You could use URI to safely parse and modify those kinds of strings.
use warnings; use strict; use URI; my $input = 'https://abc.abc:8080/abc?abcdef&abc=&egh?'; my $uri = URI->new($input); $uri->host('def.def'); $uri->port(undef); my $output = "$uri"; use Test::More; my $expect = 'https://def.def/abc?abcdef&abc=&egh?'; is $output, $expect or diag explain $output; done_testing;
In reply to Re: replace characters in link
by haukex
in thread replace characters in link
by ytjPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |