# Check if we have a tag which should replace the user-supplied URL if( $_[0] =~ s!<\s*\bbase\b[^>]+\bhref=([^>]+)>!!i ) { # Extract the HREF: my $href= $1; if( $href =~ m!^(['"])(.*?)\1! ) { # href="..." , with quotes $href = $2; } elsif( $href =~ m!^([^>"' ]+)! ) { # href=... , without quotes $href = $1; } else { die "Should not get here, weirdo href= tag: [$href]" }; my $old_url = $url; $url = relative_url( $url, $href ); #warn "base: $old_url / $href => $url"; };