Alternatively, since 5.10 came out today, you can use scary regex features:
s/\\caption(\{((?:[^\{\}]|(?1))*)\})/<caption>$2<\/caption>/;
In reply to Re: Matching delimiters
by educated_foo
in thread Matching delimiters
by pop18
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |