title: Check if password contains only letters, numbers, some extra characters
body: <p>I am trying to check whether a password contains only letters, numbers and only these characters:</p>
  
  <pre><code>~ _ &amp; * % @ $
  </code></pre>
  
  <p>I am using a regular expression as follows. But it is not working as expected:</p>
  
  <pre><code>var checkPassWordCharacters=/[a-zA-Z0-9~_&amp;*%@$]$/;
  if(checkPassWordCharacters.test(password)){
      //do Something
  }
  </code></pre>
  
  <p>What am I doing wrong, and how can I fix it?</p>