Someone would know how to mount a regex to validate numeric and alphabetic sequences of at least 4 digits, type: 1111/1234 / abcd / 4321 / dcba?
Someone would know how to mount a regex to validate numeric and alphabetic sequences of at least 4 digits, type: 1111/1234 / abcd / 4321 / dcba?
At least 4 characters, at least 1 letter and 1 number:
"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{4,}$"
If you want to validate if the password has 4 characters containing letters or numbers only. You can use this Regex:
^[^\W_]{4}$
If you want to test, I recommend this site: link
private string getRegex() { string regex = "^.*(?=.{" + this.TamanhoMinimo.ToString() + ","+this.TamanhoMaximo.ToString()+"})"; if (SenhaForte) { regex += "(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])"; if (this.CaracterEspecial) { regex += "(?=.*[@#$%^&+=])"; } } else { regex += "(?=.*[a-zA-Z0-9@#$%^&+=])"; } regex += ".*$"; return regex; } //Letras maiúsculas, minusculas, caracteres especiais (@#$%^&+=) e numeros.