r_p = re.compile('^(?=\S{6,20}$)(?=.*?\d)(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[^A-Za-z\s0-9])')
this code will validate your password with :
- min length is 6 and max length is 20
- at least include a digit number,
- at least a upcase and a lowcase letter
- at least a special characters