I couldn't make few regex patterns to work so i googled most of them and have encountered issues in the process. I mostly understand rules in play while building regex patterns but don't understand how to create regex that checks if in string is at least 1 certain type of character. This i found online:
'/^((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})$/'
What i cant understand is this:
- what this is for
?=.*does it like mean something together or just separate attributes - why is there
.between curly brackets and normal ones).{as far as i know its any character, unless it means any of previously mentioned but what makes it to work that way - the last problem is that regex works the way that it actually checks if demanded characters are provided but also allow to type something like
ąóor"(^!when i look at this i don't see anywhere that mentioned characters are allowed
As you already figured it out im trying to build password validation regex and struggling with this.
EDIT
If its possible could someone present alteration to this regex so it will not mean
- require one of digit, lower case, upper case, special char of provided list and than whatever else to fill blanks
so it would instead mean
- require one of digit, lower case, upper case, special char of provided list and fill blanks with characters of mentioned rules, so you can continue typing digits letters and special chars from provided list but not some special things like
!óż
*!óto be used, yet i can use them so im asking where is the problem, i started study regexes yesterday so hmm i might not know everything just yet(\d+)or this(\d){1,}doesnt work at all.to something else but dont know what should i place there