In most browsers - those that support Java Script 1.5 (Firefox, Chrome, Safari, Opera 7 and Internet Explorer 8 and higher) - you can use more powerful regular expressions.
This code will work for browsers as far back as Netscape 4 (circa 1997). If you're not sure how to place this on your page, you might need to read the preceding article on Form Validation, or view the HTML source of this page.
Again, you can use the form below to test this regular expression: Restricting which characters can be used is not good practice as punctuation and other symbols provide extra security.
You might implement this code on your own website as follows: As you can see, it's well worth learning the intricacies of regular expressions.
The problem here is that you're making the password visible in the browser, browser cache, proxy, etc.
For security a password should never be displayed in HTML or sent by email.