title: get substring until nth match regex
body: <p>Let's say I have the string:</p>
  
  <pre><code>"Hello world; some random text; foo; bla bla; "
  </code></pre>
  
  <p>what regular expresion could I use in order to get a substring until the second <code>;</code> . </p>
  
  <p>In other words I will like to end up with the substring <code>"Hello world; some random text;"</code></p>
  
  <p>or maybe I want to get the substring until the 3th ; thus ending up with:</p>
  
  <pre><code>"Hello world; some random text; foo;"
  </code></pre>