in reply to regex substitution

The previous examples either ignore greedy matching or attempt to to emulate it. I believe this is what you're looking for:

$text =~ s/#(\w+?)#/$hash{$1}/g;

--
pabs (who's too lazy to create an account)
pabs@pablotron.org

Replies are listed 'Best First'.
Re: Re: regex substitution
by chromatic (Archbishop) on Nov 06, 2001 at 06:28 UTC
    That would be a problem if \w included the octothorpe. It doesn't, so it's not a problem.