How to get parentheses inside parentheses
问题 I'm trying to keep a parenthese within a string that's surrounded by a parenthese. The string in question is: test (blue,(hmmm) derp) The desired output into an array is: test and (blue,(hmmm) derp) . The current output is: (blue, , (hmm) and derp) . My current code is thatof this: var input = Regex .Split(line, @"(\([^()]*\))") .Where(s => !string.IsNullOrEmpty(s)) .ToList(); How can i extract the text inside the outside parentheses (keeping them) and keep the inside parenthese as one string