title: How to remove all special characters except numbers and space in a string using JavaScript?
body: <p>I'm developing a Phonegap Android application. Now I want to pass some parameters from one page to another html page. I'm not using any server side methods. In the second page I want to get all passed parameters from first page using JavaScript.</p>
  
  <p>For example here is an URL:</p>
  
  <blockquote>
    <p>file:///C:/Users/dell/Projects/testapp1/search_result.html?searchstr=word1+*%26^+word2+3+word3+%40%23&amp;city=city&amp;showdishesnearby=false</p>
  </blockquote>
  
  <p>The below function used to extract each parameters values:</p>
  
  <pre><code>function getUrlVars() {
      var vars = {};
      var parts = window.location.href.replace(/[?&amp;]+([^=&amp;]+)=([^&amp;]*)/gi,
          function (m, key, value) {
              vars[key] = value;
          });
      return vars;
  }
  
  searchString = getUrlVars()["searchstr"]; // this is how I call above function to get value of passed particular parameter
  </code></pre>
  
  <p>Now I want to remove all special characters except numbers and white space in variable <code>searchString</code>.  </p>
  
  <p>I have used the below code:</p>
  
  <pre><code>searchString = searchString.replace(/[^a-zA-Z ]/g, " ");
  </code></pre>
  
  <p>but that doesn't solve my problem. How to remove all special characters except numbers and space in a string using JavaScript?</p>