Regular Expression for Removing (nested) Parentheses
===

I am using DOM to get a Wikipedia article as a NSString and then using NSString stringByReplacingOccurrencesOfString:withString:options:range: to remove unneeded things. I'm using regular expressions, which I don't have much experience with. From reading Apple's documentation and just trying things I was able to make this

    "\\[[\\w]+\\]"

regular expression which removes the brackets from the Wikipedia article. This works perfectly fine because brackets aren't nested.

Now I am trying to remove parentheses (including everything inside them (and nested ones)) from the NSString. I'm having problems with the nesting part. With this

    \\s+\\([^\\)]*+\\)
regular expression I was able to remove a set of parentheses including the space before it (so I don't end up with duplicate spaces after is removed). What regular expression could I use to do this same thing but also remove nested parentheses instead?

My current implementation will change this

> The quick brown (slightly reddish) fox jumped over the lazy (he was old (26 years) and exhausted) dog.

into this

> The quick brown fox jumped over the lazy and exhausted) dog.

while the desired result is this

> The quick brown fox jumped over the lazy dog.