title: Replace second to last "/" character in URL with a '#'
body: <p>I have this URL:</p>
  
  <pre><code>http://localhost:8888/alain-pers/fr/oeuvres/architecture/
  </code></pre>
  
  <p>I would like to replace the second to last <code>/</code> with <code>#</code> (I need the last <code>/</code>) and get the following output:</p>
  
  <pre><code>http://localhost:8888/alain-pers/fr/oeuvres#architecture/
  </code></pre>
  
  <p>I've tried a lot of things with <code>indexOf()</code>, <code>lastIndexOf()</code> and <code>substr()</code>, but I can't get the result I want. I couldn't get any regex solution to work properly, either.</p>
  
  <p>Note that sometimes the link looks like this, with a <code>-</code>, too: </p>
  
  <pre><code>http://localhost:8888/alain-pers/fr/oeuvres/art-contemporain/
  </code></pre>