I'm trying to learn a more advanced regular expressions for a password validator I'm working on because I think using regular expressions would be the best way out. I am using Java as my programming language
So for my pattern people suggested this (?=.*?[A-Z])
as to say "at least one upper case in the string". I have tried searching it at least but nothing seems to make it clear ?=.*?
how this part makes sure it at least there.
here is the whole pattern ^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$
from what i understand
- ? means optional and occurs once
- = means well i don't know yet
- . is a wildcard
- [A-Z] is the range of uppercase letters from A-Z
TLDR: So my question is how does this (?=.*?[A-Z])
make it sure atleast one uppercase letter is included? Any in-depth explanation?