REGEX is not exactly my favorite technology to have to work with, but there are times when it is definitely the right tool for the job. Recently I needed to parse a large text file that contained blocks of information within curly brackets - {}.
I found a great solution for the REGEX at:
http://blog.stevenlevithan.com/archives/balancing-groups
Note that balancing groups is only in the Microsoft REGEX classes... if you are using a different library you may have to follow an alternative, less powerful route where you know the number of levels that may be used:
http://blog.stevenlevithan.com/archives/regex-recursion
KUDOS to Steve...
My final solution by the way was:
@"\{(?>[^{}]+|\{(?
)|\}(?<-Depth>))*(?(Depth)(?!))\}"