<input type="password" name="password" pattern="^[AZ][az]{4,}[0-9]{4,}$"> I can't figure out how to change a regular expression to get the condition for at least one uppercase letter, not necessarily the FIRST .
I can't figure out ...">
<input type="password" name="password" pattern="^[AZ][az]{4,}[0-9]{4,}$"> I can't figure out how to change a regular expression to get the condition for at least one uppercase letter, not necessarily the FIRST .
Password field: Minimum 8 characters, one digit, one uppercase letter and one lowercase
^(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[AZ])(?=.*[az]).*$ Took from here .
Sorry for the incorrectly formulated question. The task was this: the password should consist of at least 8 characters, 4 of which are digits, 4 letters (at least one upper and at least one lower case). It turned out so. Thanks for the tips!
^(?=.*[az])(?=.*[AZ]).{4,}(?=.*\d).{4,}$ "^.*[AZ]+.*$" Means "Start of line, any character 0 or more times, capital letter 1 or more times, any character 0 or more times, end of line".
An expression that exactly matches the task:
condition of at least one uppercase letter
UPD. As Numminorich correctly observed,
in general, it would be possible to reduce to
"[AZ]+", well, if necessary, add Russian letters
"[AZ]+" , well, if necessary, add Russian letters - NumminorihSFSource: https://ru.stackoverflow.com/questions/507219/
All Articles