Been playing around with JavaScript, and what Im trying to do is only allow certain characters in the pass word field - a-z, A-Z and 0-9.
if (name.match(/[\W_]/)) { //...
Meaning if the "name" string has any character which is a non-alphanumeric or an underscore then execute the block. Note that we have to separately check for underscore (_) because the alphanumeric character class (\w) includes the underscore (so the negative class (\W) does not).