in reply to Re^2: initializing internal regex variables?
in thread initializing internal regex variables?

I think you expect
perl -e' $_ = qq{...\n} .qq{<a href="foo">foo</a>\n} .qq{<a href="bar">bar</a>\n} .qq{...\n}; s!(<a href=")(.*?)(">bar</a>)!$1\[$2]$3!s; print; '
to output
... <a href="foo">foo</a> <a href="[bar]">bar</a> ...
but that's wrong. It outputs
... <a href="[foo">foo</a> <a href="bar]">bar</a> ...

The pattern says to match

Keeping in mind that "as few characters as possible" is zero characters, let's check if the string matches: