in reply to matching substring in url

I though I'd use URI, but the "query" part is usually separated by ? instead of ;. Fortunately, the semicolon also works:
#!/usr/bin/perl use warnings; use strict; use URI; use Test::More tests => 2; my %expect = ( '/blah1/blah2/blah3/1234567890;arg=AAA123BBB456CCC' => '1234567890 +', '/blah1/blah2/blah3/1234567890' => '1234567890'); for my $string (keys %expect) { my $uri = ('URI'->new($string)->path_segments)[-1]; is $uri, $expect{$string}; }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: matching substring in url
by cioperl (Novice) on Nov 08, 2019 at 19:37 UTC
    thanks. I'm not familiar with URI, but looks like it's the way to go.