title: How to get all value of invalid characters in a string in jquery?
body: <p>I have a jquery method that check special character as shown below:</p>
  
  <pre><code>function checkForSpecialChar(val) {
  
      if (val != 0 &amp;&amp; /^[a-zA-Z0-9- ]*$/.test(val) == false) {
  
          return false;
      }
  
  return true;
  }
  </code></pre>
  
  <p>This is working fine as it validate the value correctly.</p>
  
  <p>However now I need to get all invalid characters for the val string and show it to the user.</p>
  
  <p>So for example <code>if val is = 123gdf$£!</code>
  It should get only the invalid character which is <code>$£!</code>.</p>
  
  <p>Any idea how i can do that please?</p>
  
  <p>Thanks in advance for any help.</p>