 <p>You can match any non-(letters, digits, and underscores) characters with <code>\W</code>.</p> <p>So to check the password if has any special character you can just simply use:</p> <pre><code>if (password.match(/\W/)) { alert('you have at least one special character'); } </code></pre> <p>to use it in your function you can replace the whole regex with:</p> <pre><code>var passwordPattern = /^[\w\W]*\W[\w\W]*$/; </code></pre> <p>that will return true if the string has at least one special character.</p>