title: C# regex. Optional match after string
body: <p>I have an input like this <code>test1.test2.part01</code> which I want to strip away to <code>test1.test2</code>. The only thing i know is that it will end with <code>partxx</code> and probably a dot before the <code>partxx</code>. However, it will not always be a apart. Another example of input might be <code>testas1.tlp2.asd3.part10</code> which ofcourse should be stripped to <code>testas1.tlp2.asd3</code>. </p>
  
  <p>I've made all that, no problem. The problem is the dot at the end before <code>partxx</code>. My regex at the moment is:</p>
  
  <pre><code>(.*)\.?part\d{1,2}
  </code></pre>
  
  <p>But it will include the dot in the group. I do not want the dot to be in the group. The below works as I want it, given that the dot exists, but it will not always be there.</p>
  
  <pre><code>(.*)\.part\d{1,2}
  </code></pre>
  
  <p>How can I exclude the optional dot from the group?</p>