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
In reply to Re: Re: s// problem
by Hofmator
in thread s// problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |