People has already answered your question, so I just wonder if \caption{*} is TeX code? If so, there are CPAN modules for parsing it.
lodin
In reply to Re: Matching delimiters
by lodin
in thread Matching delimiters
by pop18
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |