title: How to extract a substring from a sentence until a delimeter
body: <p>Hi I have some string like this:</p>
  <pre><code>location/city/home-a-berlin?/someNewAdress
  </code></pre>
  <p>I want to extract word berlin which placed between &quot;-a-&quot; and &quot;?&quot;. How can i do that with regex in java?</p>
  <p>I can do it by using string API but kinda stuck with regex.</p>
  <pre><code>String cityName = url.substring(url.lastIndexOf(&quot;-a-&quot;)+3, url.indexOf('?')) //berlin
  </code></pre>