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 print all Strong numbers in given list
- Python program to find all Strong Numbers in given list
- Verbose in Python Regex
- Python Regex: re.search() VS re.findall()
- Pattern matching in Python with Regex
- Name validation using IGNORECASE in Python Regex
- Python - Substituting patterns in text using regex
- The most occurring number in a string using Regex in python
- Python | Program that matches a word containing 'g' followed by one or more e's using regex
- Python | Parse a website with regex and urllib
- Find all the patterns of “1(0+)1” in a given string using Python Regex
- Python | Check if string matches regex list
- Python | Swap Name and Date using Group Capturing in Regex
- Python Regex to extract maximum numeric value from a string
- Python regex | Check whether the input is Floating point number or not
- Regex in Python to put spaces between words starting with capital letters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.