The pattern you are using is [^A-Za-z0-9] which is actually "match any character except A-Z, a-z, and 0-9".  The ^ at the front negates the pattern.

Also, you're not using any sort of repetition modifier such as *, +, ?, or {n,m}.  How many characters do you want your password to be?   Use + to signal "at least one".

So, you probably want to change the pattern to "[A-Za-z0-9]{4,8}"  which will match any alphanumeric repeated from 4 to 8 times.  Or use "[A-Za-z0-9]+" to match any alphanumeric character at least once.  Then, when matches returns true your password is validated.

-d




function checkPass(strPassword:String):Boolean{

var regexPassword         :Pattern             = new Pattern("[^A-Za-z0-9]");

var matchPassword        :Matcher           = new Matcher(regexPassword, strPassword);

return matchPassword.matches();

}

 

It is always returning false, im sure my syntax is wrong. Can you point me in the right direction please?


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to