title: How to remove the end of a string, starting from a given pattern?
body: <p>Let's say I have a string like this:</p>
  
  <pre><code>var str = "/abcd/efgh/ijkl/xxx-1/xxx-2";
  </code></pre>
  
  <p>How do I, using Javascript and/or jQuery, remove the part of <code>str</code> starting with <code>xxx</code>, till the end of <code>str</code>?</p>