title: Regular expression for relative URLs (segment after the domain name) [& no querystring]
body: <p>The relative URLs that I need to match are as follows:</p>
  
  <pre><code>/
  /asdf
  /asdf.php
  /sdfsf/
  /asdfsdf/asdf
  /asdfsdf/s-_df.jpg
  /
  /asdf#
  /asdf.php#
  /sdfsf/
  /asdfsdf/asdf#
  /asdfsdf/s-_df.jpg#
  </code></pre>
  
  <p>I have tried a number of patterns but seem to be hitting the wall - 
  <a href="https://regex101.com/r/GnK43b/4" rel="nofollow noreferrer">https://regex101.com/r/GnK43b/4</a>
  <a href="https://regex101.com/r/GnK43b/1" rel="nofollow noreferrer">https://regex101.com/r/GnK43b/1</a></p>
  
  <p>In the outcome, I need the the regex groups such that I get the segments:
  For e.g.</p>
  
  <pre><code>/sdfsf/ =&gt; Group 1: sdfsf
  /asdfsdf/asdf =&gt; Group 1: asdfsdf; Group 2: asdf
  </code></pre>