Hi,
I would recomment on using the recursive parser toolkit
from Damian Conway. Although you should be able to do it
with some regexes and a stack-machine also.
A single RE will not work though, as this problem is non
trivial. I read in one of the replies that you'll need a
lexer and a parser ( execellent reply! ) but they can get
very simple. The lexer can be a simple list of regexes and the parser can be a simple array in which you pop, push stuff ( stack ).
A good pointer to solve this problem can be:
http://www.yapc.org/Europe/2001/proceedings/68/index.html
and
http://www.samag.com/documents/s=1288/sam03040010/
Hope this helps a bit ...
J.