$_ = '/path/sub/dir';
$d = '/path';
$d = quotemeta $d;
print $1 if /"\s*>.*?$d(.*?)<\/A>/i;
# prints /sub/dir
# here it is with the regex expanded
$_ = '/path/sub/dir';
$d = '/path';
$d = quotemeta $d;
print $1 if m # match regex
/ # opening delim
" # literal "
\s* # plus 0 or more spaces
> # end of # the closing tag
/ix; # /i => case insensitive for tag
# /x => allow comments