RegEx is nice because you can accomplish a whole lot with very little. In this case we are going to check various aspects of a string and see if it meets our requirements, being a strong or medium strength password.
To show the password strength to the user, we’re going to use a rectangle that contains a color. We’ll say that a red rectangle holds a weak password, orange medium, and green a strong password. The HTML behind this would look something like the following: