title: Javascript Split URL
body: <p>I want to SPLIT some specific parts of the URL, here is what i have so far.</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  var query = window.location.pathname.split( '/' );
  query = window.location.pathname.split( '.html' );
  
  var redirectpath = "http://www.mydomain.com/search/?q="
  window.location.href = redirectpath + query;
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>The URL structure will be like this:</strong></p>
  
  <pre><code>http://www.mydomain.com/page/2013/05/some-page-title.html
  </code></pre>
  
  <p>The variable <code>query</code> outputs like this;
  <code>page,2013,05,some-page-title</code></p>
  
  <p>i only want the <code>some-page-title</code> part and also remove the hyphens.</p>
  
  <p>so the final output would be <code>http://www.mydomain.com/search/?q=some page title</code></p>
  
  <p>how is that possible? Please help!!
  Thanks</p>