title: extracting recurring pattern with regular expressions
body: <p>I have some text where a list of (id (in the form Pnumber) , a dash and a name) are written.
  like in:</p>
  
  <pre><code>P1 - code23
  P2 - name asd, P3 -name3
  P3 - 837/55 P5 - code/55
  </code></pre>
  
  <p>as you see the couples PX - name can be divided by \n, comma,or simple spaces.</p>
  
  <p>with the regexp pattern</p>
  
  <pre><code>(((?&lt;id&gt;P\d)(\s)?-(\s)?(?&lt;name&gt;(.)*)(,)?(\n)?))   
  </code></pre>
  
  <p>I can extract the name group of matches repeated on different lines, but not the one divided by , or space.
  the names extracted from the text above are</p>
  
  <pre><code>code23 (right)
  name asd, P3 -name3 (wrong)
  837/55 P5 - code/55 (wrong)
  </code></pre>
  
  <p>How can I modify my pattern?</p>