title: How to extract the filename of the URL of the current document path in JavaScript?
body: <p>I'm trying to extract the current file name in Javascript without any parameters.</p>
  
  <pre><code>$(location).attr('href').match(/([a-zA-Z\-\_0-9]+\.\w+)$/);
  var current_path = RegExp.$1;
  if ((current_path == 'index.html') || ...) {
    // something here
  }
  </code></pre>
  
  <p>But it doesn't work at all when you access like <i>http://example.com/index.html?lang=ja</i>. Sure before the file name will be changed at random. </p>
  
  <p>Any idea?</p>