Below is a simple example that uses the class to display the security level as well as updating a HBox to show a visual indication of the quality of your password.
The crieteria for the regular expressions are to check Capital letters, standard letters, numbers and none word characters to build up the quality level Right click to view source
package co.uk.BetaDesigns.utils.string { public class PasswordStrength { private static var _strength : Number = 0; private static var _regSmall : RegExp = new RegExp( /([a-z]+)/ ); private static var _regBig : RegExp = new RegExp( /([A-Z]+)/ ); private static var _regNum : RegExp = new RegExp( /([0-9]+)/ ); private static var _regSpecial : RegExp = new RegExp( /(\W+)/ ); public static function checkStrength( password : String ) : Number { _strength = 0; if( password.search( _regSmall ) != -1 ) { _strength ++; } if( password.search( _regBig ) != -1 ) { _strength ++; } if( password.search( _regNum ) != -1 ) { _strength ++; } if( password.search( _regSpecial ) != -1 ) { _strength ++; } return _strength; } public function PasswordStrength( se : SingletonEnforcer ) { //Force it so the user can't get here; } } } class SingletonEnforcer{}