Assuming your brackets are balanced, here's a drop-in regex for you:
/$profile .*?
( #Group 1
{
(?:
[^{}]+ | (?1) #If not brackets, eat up. Otherwise, recurse
on group 1.
)*?
}
)
/gx;
Minimally adapted from Anon.'s answer in StackOverflow[0]. Gosh, I've had
that bookmarked for weeks, waiting for a chance to use it.
..I'll admit that I hold little idea of what it does, though - look up
(?PARNO) in perlre[1] for the interesting details on recursive patterns.
[0]
http://stackoverflow.com/questions/1950409/removing-text-within-parentheses-parentheses-within-parentheses-prob
[1] http://perldoc.perl.org/perlre.html