The best advice anyone can give you is to use a parser, not regular expressions. While it's probably possible to build a state machine with Perl 5 regular expressions which handles all of the possible tokens and states and state transitions appropriately, no one I know capable of writing such a thing has actually done it.
You might be able to get by with regular expressions and Text::Balanced -- we use that in Parrot to build PMCs out of our PMC mini-language which includes C code -- but for anything more complex, you'll have a much easier time using a parser.