title: javascript regex url (url substring)
body: <p>Hey guys i have written a simple function which reads the current url and sets some kind of highlight.</p>
  
  <p>If I open up the url everything works fine but if I do more advanced request it's not working.</p>
  
  <p>example: If i request "/customers" it works but if I request "/customers/10" it's not working anymore.
  Can someone provide me with some regex action ?</p>
  
  <p>Thanks in advance</p>
  
  <pre><code>function setGUI() {
  var url = window.location.pathname;
  switch(url) {
      case "/orders":
          $(document).ready(function() {
              $(".nav li:nth-child(2)").addClass("active");
          });
          break;
  
      case "/customers": // match "customers/any_id"
          $(document).ready(function() {
              $(".nav li:nth-child(3)").addClass("active");
          });
          break;
  
      case "/partners": match "partners/anyid"
          $(document).ready(function() {
              $(".nav li:nth-child(4)").addClass("active");
          });
          break;
  
      case "/help":
          $(document).ready(function() {
              $(".nav li:nth-child(5)").addClass("active");
          });
          break;
  
      case "/users/": // match "/users/any_id/"
          $(document).ready(function() {
              $(".nav li:nth-child(6)").addClass("active");
          });
          break;
  
      default:
          alert("debug");
      }
  }
  
  setGUI();
  </code></pre>