in reply to replace characters in link
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: replace characters in link
by ytjPerl (Scribe) on Dec 11, 2018 at 15:56 UTC | |
by haukex (Archbishop) on Dec 11, 2018 at 16:01 UTC |