title: Get substring before DESC or ASC via JavaScript or JQuery
body: <p>I have got some URLs like that   </p>
  
  <pre><code>/WebSite/Movies/807?sort=MovieName&amp;sortdir=DESC&amp;p2=2&amp;p3=3
  
  /WebSite/Movies/807?sort=MovieName&amp;sortdir=ASC&amp;p4=4&amp;p5=5
  </code></pre>
  
  <p>and I need to get only part like</p>
  
  <pre><code>/WebSite/Movies/807?sort=MovieName&amp;sortdir=DESC
  
  /WebSite/Movies/807?sort=MovieName&amp;sortdir=ASC
  </code></pre>
  
  <p>How it can be done via <strong>JavaScript Regex or JQuery</strong>?</p>
  
  <p>I know there some online tools like <a href="http://regexpal.com/" rel="nofollow">http://regexpal.com/</a> and etc but I cannot figue out how to determine that string ends with DESC or ASC.</p>
  
  <p>Thank you!</p>