use Regexp::Common; my $url = 'http://www.perlmonks.org/index.pl'; print $3 if $url =~ /$RE{URI}{HTTP}{-keep}/;