title: C# and Regex - Unrecognized grouping construct
body: <p>Currently working on my thesis for a client/server app. I've run into a snag were the server receives information like this:</p>
  
  <pre><code>ProToCooL,unknown|DESKTOP-29COFES,10.20.9.53|Hewlett-Packard,179C,PCWJA001X3UHII,KBC Version 42.32|i5-3320M,2.60GHz,2,4,256,3072,U3E1,GenuineIntel|{2,(IDT High Definition Audio CODEC,IDT),(Intel(R) Display Audio,Intel(R) Corporation)}|{2,(Samsung,003355A3,M471B5773DH0-CH9  ,24,2147483648,1333),(Hynix/Hyundai,467CA639,HMT351S6EFR8A-PB  ,24,4294967296,1333)}|{1,(IDE,Hitachi HTS725050A7E630,      FT51009Y7J61BK,3,733004892,476937.531738281)}|{7,(Send To OneNote 2013,False,Local,Send to Microsoft OneNote 15 Driver),(Microsoft XPS Document Writer,False,Local,Microsoft XPS Document Writer v4),(Microsoft Print to PDF,False,Local,Microsoft Print To PDF),(HP Universal Printing PCL 6,False,Local,HP Universal Printing PCL 6),(HP LaserJet P3010 Series (10.20.9.36),False,Local,HP Universal Printing PCL 6),(Fax,False,Local,Microsoft Shared Fax Driver),(Adobe PDF,True,Local,Adobe PDF Converter)}
  </code></pre>
  
  <p>And I have the current pattern set up:</p>
  
  <pre><code>\(((?:[^()]|(?R))+)\)
  </code></pre>
  
  <p>which does a decent job of extracting everything that I need, but the problem is that when i use it in C# in this way:</p>
  
  <pre><code>if(soundCount &gt; 0)
          {
              string[] smth;
              string pattern = @"\(((?:[^()]|(?R))+)\)";
              Regex match = new Regex(pattern, RegexOptions.None);
  
              MatchCollection matches = match.Matches(sound);
              smth = new string[matches.Count];
  
              int i=0;
              foreach (Match ma in matches)
              {
                  smth[i] = Regex.Replace(ma.Value.Trim('(', ')'), @"\s+", "");
                  Console.WriteLine(smth[i]);
                  i++;
              }
  
  
              IList&lt;sound_chips&gt; newSoundchip = new List&lt;sound_chips&gt;();
              foreach(string s in smth)
              {
                  newSoundchip.Add(new sound_chips() 
                  { 
                      name = s.Split(',')[0].ToString(), 
                      manufacturer_id = Convert.ToInt32(setManufacturer(s.Split(',')[1].ToString())),
                      motherboards = newMotherboard
                  });
              }
              insert.sound_chips.AddRange(newSoundchip);
          }
  </code></pre>
  
  <p>I get an: Unrecognized grouping construct. exception and I'm having difficulties finding what's wrong cuz I don't really understand regexp for C# that much or find a way around it for that matter.</p>