Validating a User Defined Password With Reg Exp

A nice little reg exp from the ColdFusion Cookbook when you need to make sure a users new password (which they are setting) contains at least 1 letter and 1 number.

You can also make sure the password length is within a range, the following makes sure the password is between 6 and 15 characters long.

<cfif NOT reFind("^[[:alnum:]]{6,15}$", form.sPassword) />

Don’t you just love regular expressions :)

Comments