title: Java extract substring from url string
body: <p>I want to extract substring from a url string.
  This is the url:</p>
  
  <pre><code>  https://test.tech.com/public/pi?id=635106391297495358_0_280740c3f281419b954b309b45a41d77-M_M_0_56b6f628b90b4146abbdba1de9095657
  </code></pre>
  
  <p>I want to start extracting from id=</p>
  
  <pre><code>  635106391297495358_0_280740c3f281419b954b309b45a41d77
  </code></pre>
  
  <p>until dash (-), and then extract the remaining substring</p>
  
  <pre><code>  M_M_0_56b6f628b90b4146abbdba1de9095657
  </code></pre>
  
  <p>Note that the exact domain is not the one in the above, that's just an example .</p>
  
  <p>Any ideas? I would gladly appreciate your help. Thanks.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>this is what I've done so far:</p>
  
  <pre><code>  final URI uri = URI.create(result.getContents());
                      final String path = uri.getPath();
                      path.substring(path.lastIndexOf('-') + 1);
                      Log.e("EXTRACTED", "" + path);
  </code></pre>
  
  <p>But it just gets public/pi. </p>