title: Switch Case Regex Test
body: <pre><code>var path = location.pathname;
   switch(path){
    case (/\/memberlist/).test(path) :getCSS('url-22.css'); break;
    case (/\/register/).test(path):  getCSS('url-6.css');  break;
    case (/buy-credits/g).test(path): getCSS('url-7.css'); break;
    case (/\/?u(\d+)friends$/).test(path): getCSS('url-8.css'); break;
    case (/\/privmsg/).test(path): getCSS('url-9.css'); break;
    case (/\/?u(\d+)wall$/).test(path): getCSS('url-4.css'); break;
   }
    function getCSS(url,media){
         var a = document.createElement('link');
             a.href=url;
             a.media= media || 'screen';
             a.rel="stylesheet";
       return (document.getElementsByTagName('head')[0].appendChild(a));    
    }
  </code></pre>
  
  <p>That is my code, and for some reason it's not running the function that should run. For testing purpose we could change <code>var path="/memberlist"</code> and it still won't run. Can someone explain to me why this won't run. Don't really use switch statements</p>