title: Remove spaces , dots and special chars from a string and replace with hyphen in jQuery
body: <p>I have a string where there may be special characters, which I have to replace with hyphen</p>
  
  <pre><code>var str="123.This is,, :ravi"
  </code></pre>
  
  <p>The above string should be converted like this</p>
  
  <pre><code>var newstr="123-This-is-ravi";
  </code></pre>
  
  <p>I have been trying this</p>
  
  <pre><code>function remove(str){ str.replace(/\./g, "-"); }  //replaces only dots
  function remove(str){ str.replace(/ /g, "-"); }   //replaces only spaces
  </code></pre>
  
  <p>Can any one help me doing this? I need to replace special chars with hyphen.</p>