How can I validate a password to make sure it contains numbers and letters and is at least X characters long?

Regular expression combined with the <cfif> and reFind() function give you the flexibility to validate against all kinds of requirements.

In the following code sample, the password will have to contain at least one letter and number and be between 6-15 positions long.

<cfif NOT reFind("^[[:alnum:]]{6,15}$",usr_pwd)>

This question was written by Christopher Legge
It was last updated on October 19, 2006.




comments powered by Disqus