title: Regex between two nth position characters
body: <p>I'm trying to fetch some data depending from a text string that lies between two characters (_) but could be a word in a nth position.</p>
  
  <p>Currently I have the following</p>
  
  <pre><code>!((?:.*?(_)){2})_(.+?)$
  </code></pre>
  
  <p>working on the following data</p>
  
  <pre><code>D20_Mbps_U10_Mbps_TC4_P
  </code></pre>
  
  <p>where I would expect to get  </p>
  
  <pre><code>U10
  </code></pre>
  
  <p>but get nothing as the first part captures </p>
  
  <pre><code>D20_Mbps_
  </code></pre>
  
  <p>and thus leaves nothing for the second part to capture</p>
  
  <p>I've tried</p>
  
  <pre><code>_\s*(.*?)(?=\s*_)
  </code></pre>
  
  <p>But this only gives me the first occurance where I need it to be nth position. Where I can supply n at runtime.</p>
  
  <p>any ideas?</p>
  
  <p>Thanks</p>