Skip to content

Commit

Permalink
RegEx Example
Browse files Browse the repository at this point in the history
  • Loading branch information
meleksabit committed Dec 8, 2022
1 parent 03223f8 commit d63b83b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions RegEx_password_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Using RegEx, construct a password validation that contains
# At least 8 characters
# contains any type of letters, numbers and $%#@
# and ends with a number

import re

pattern = re.compile(r'[a-zA-Z0-9$%#@]{8,}\d$')
string = 'user123$#@3'
a = pattern.fullmatch(string)

if a == None:
print('your password must be at least 8 digits long\n contain letters, numbers, any of these symbols $%#@ and end with a number')

else:
print('logged in')

0 comments on commit d63b83b

Please sign in to comment.