What is Regex?
A regular expression is a sequence of characters that define a search pattern. Usually, such patterns are used by string searching algorithms for find or find and replace operations on strings, or for input validation.
This article is definitely not to teach you regular expressions. Just know that the ability to use Regular Expressions will absolutely simplify your development as you search for patterns in text. It’s also important to note that most development languages have optimized regular expression use… so rather than parsing and searching strings step-by-step, Regex is typically much faster both server and client-side.
Type A Password
With each stroke of the keyboard, the password is tested against the regular expression and then feedback is provided to the user in a span beneath it.
Here’s the Code
The Regular Expressions do a fantastic job of minimizing the length of the code:
- More characters – If the length is under 8 characters.
- Weak – If the length is less than 10 characters and doesn’t contain a combination of symbols, caps, text.
- Medium – If the length is 10 characters or more and has a combination of symbols, caps, text.
- Strong – If the length is 14 characters or more and has a combination of symbols, caps, text.
Hardening Your Password Request