title: Regex ",\\s(.*?),\\s"
body: <p>Why regex is not working correctly?</p>
  
  <pre><code>string findarg2 = ",\\s(.*?),\\s";
  
  foreach (Match getarg2 in Regex.Matches(tmptwopart, findarg2))
  if (getarg2.Success)
  {
      for (int m = 1; m &lt; getarg2.Groups.Count; m++)
      {
          int n;
          bool needpointer = false;
          for (n = getarg2.Groups[m].Value.Length - 1; n &gt; -1; n--)
          {
              if (getarg2.Groups[m].Value[n] == ' ')
                  break;
              else if (getarg2.Groups[m].Value[n] == '*')
              {
                  needpointer = true;
                  break;
              }
          }
          n++;
  
          string part1 = getarg2.Groups[m].Value.Remove(n);
          string part2 = getarg2.Groups[m].Value.Remove(0, n);
          Console.WriteLine(getarg2.Groups[m] + " =-&gt;" +part1+ " AND " + part2);
          Console.ReadKey();
          if (needpointer)
          {
              createarglist.Append("&lt;&lt; *(" + part1 + ")" + part2);
          }
          else
          {
              createarglist.Append("&lt;&lt; " + part2);
          }
          createarglistclear.Append(part2+",");
      } }
  </code></pre>
  
  <p>Example enter string:</p>
  
  <pre><code>(DWORD code, bool check, float *x1, float *y1, float *x2, float *y2)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;&lt; check&lt;&lt; *(float *)y1
  </code></pre>
  
  <p>Expected:</p>
  
  <pre><code>&lt;&lt; check&lt;&lt; *(float *)x1&lt;&lt; *(float *)y1&lt;&lt; *(float *)x2
  </code></pre>