Guest User

Untitled

a guest
Jul 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. [A-Z]+[a-z]+w{1,}
  2.  
  3. import re
  4. pattern_password = re.compile(r'^(?=.*[0-9].*)(?=.*[a-z].*)(?=.*[A-Z].*)[0-9a-zA-Z]{8,}$')
  5.  
  6. print(bool(pattern_password.match('absghk4D'))) # True
  7. print(bool(pattern_password.match('abc123FF'))) # True
  8. print(bool(pattern_password.match('123ABCac'))) # True
  9. print(bool(pattern_password.match('abcFF123'))) # True
  10. print()
  11. print(bool(pattern_password.match('absghk4D $%#$'))) # False
  12. print(bool(pattern_password.match(''))) # False
  13. print(bool(pattern_password.match('bsghk4D'))) # False
  14. print(bool(pattern_password.match('abc_aaFF'))) # False
  15. print(bool(pattern_password.match('abcabcac'))) # False
  16. print(bool(pattern_password.match('ABCDF!@##'))) # False
  17.  
  18. ...[0-9a-zA-Z$%#^]{8,}$')
  19.  
  20. print(bool(pattern_password.match('$b#FF123'))) # True
  21.  
  22. import re
  23.  
  24. def test_pwd(pwd):
  25. def f(exp, word=pwd):
  26. return bool(re.search(r'{}'.format(exp), word))
  27. return f('d') and f('[A-Z]') and f('[a-z]') and f('[0-9a-zA-Z]{8,}')
  28.  
  29. print test_pwd("absghk4D") # True
Add Comment
Please, Sign In to add comment