in reply to Re: s// problem
in thread s// problem

Try making your quantifier, in this case +, non-greedy, with a ? after it.

I don't think this is necessary here. After all the tag is already surrounded by special symbols, the percentage sign ('%'). So why not just use the greedy modifier with a negated character class (of course you can't have any '%' chars in the tag names): s/\%([^%]+)\%/$template{$1}/g;

-- Hofmator