Given a password, we have to categorize it as a strong or weak one. There are some checks that need to be met to be a strong password. For a weak password, we need to return the reason for it to be weak.
Conditions to be fulfilled are:
- Minimum 9 characters and maximum 20 characters.
- Cannot be a newline or a space
- There should not be three or more repeating characters in a row.
- The same string pattern(minimum of two character length) should not be repeating.
Note: For checking the basic validations of a password, click here.
Input1 : Qggf!@ghf3 Output1 : Strong Password! Input2 : aaabnil1gu Output2 : Weak Password: Same character repeats three or more times in a row Input3 : Geeksforgeeks Output3 : Weak Password: Same character repeats three or more times in a row Input4 : Aasd!feasnm Output4 : Weak password: Same string pattern repetition Input5 : 772*hdf77 Output5 : Weak password: Same string pattern repetition Input6 : " " Output6 : Password cannot be a newline or space!
Below is the implementation.
Weak password: Same string pattern repetition
Weak Password: Same character repeats three or more times in a row
Password cannot be a newline or space!
- Generating Strong Password using Python
- Python | Categorize the given list by string size
- Python | Categorize tuple values into dictionary value list
- Weak References in Python
- Python program to find all Strong Numbers in given list
- Python program to print all Strong numbers in given list
- Pafy - Getting Weak Reference of Stream
- Find all the patterns of “1(0+)1” in a given string using Python Regex
- Python | Program that matches a word containing 'g' followed by one or more e's using regex
- The most occurring number in a string using Regex in python
- Name validation using IGNORECASE in Python Regex
- Python | Swap Name and Date using Group Capturing in Regex
- Python - Substituting patterns in text using regex
- Python program to Count Uppercase, Lowercase, special character and numeric values using Regex
- How to check if a string starts with a substring using regex in Python?
- Python program to find files having a particular extension using RegEx
- Parsing and Processing URL using Python - Regex
- Python - Check if String Contain Only Defined Characters using Regex
- Python | Random Password Generator using Tkinter
- How to Remove repetitive characters from words of the given Pandas DataFrame using Regex?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.