title: Javascript - Replace all non-alpha numeric characters except period
body: <p>I need to replace all non alpha-numeric characters in a file name except for the period, I've been searching around and found close answers but not exact, here is what I narrowed it down to:</p>
  
  <pre><code>var temp = originalname.replace(/\W+/g, "_");
  </code></pre>
  
  <p>But this replaces everything, how can I exclude the period here (or any other characters if possible)?</p>