I'd tried negative lookahead before without success. But
your suggestion made me try harder and I finally got it to
work! I had a problem with the order of the characters in
$junk being strangely significant until I switched to
single quotes:
my $junk = '<>]="\'';
$text =~ s{(?!$junk)\b($urls:[$any] +?)(?=[$punc]* [^$any]|$) }{<a hre
+f="$1">$1</a>}migox;