Create Regex Pattern for String using C#
<p>I have string pattern like this:</p>

<pre><code>#c1 12,34,222x8. 45,989,100x10. 767x55. #c1
</code></pre>

<p>I want to change these patterns into this:</p>

<pre><code>c1,12,8
c1,34,8
c1,222,8
c1,45,10
c1,989,10
c1,100,10
c1,767,55
</code></pre>

<p>My code in C#:</p>

<pre class="lang-cs prettyprint-override"><code>private void btnProses_Click(object sender, EventArgs e)
{
    String ps = txtpesan.Text;
    Regex rx = new Regex("((?:\d+,)*(?:\d+))x(\d+)");
    Match mc = rx.Match(ps);
    while (mc.Success)
    {
        txtpesan.Text = rx.ToString();
    }
}
</code></pre>

<p>I've been using <code>split</code> and <code>replace</code> but to no avail. After I tried to solve this problem, I see many people using <code>regex</code>, I tried to use <code>regex</code> but I do not get the logic of making a pattern regex.</p>

<p>What should I use to solve this problem?</p>