Okay, the regex itself is actually pretty simple. The first part, \([^()]*+\) matches a set of parentheses that don't contain any other parens. The second part, (?=[^(]*+$) is a lookahead that ensures that none the characters between the closing paren and the end of the string are opening parens. Closing parens are okay, because the subexpression we just matched may be ...