I know these questions are lame and make Stack Overflow like a regex dictionary, but I really would need some help with. It’s like trying to understand hieroglyphs (at least for someone this is easy reputation).
I want to write a regex to check if password is at least 8 characters long and has at least 2 numbers or symbols (or mixed). The symbols probably can be the obvious ones [-+_!@#$%^&*.,?].
So I’ve come up with something like this so far: ^(?=.{8,})(?=.*\d{2,}).*$, but I can’t understand how to put the symbols sequence in the \d part. Oh, I’m not sure if (?=) does work for Java, does it? This rubular.com/r/VC0ncbDlRl made writing regex little easier.
That is not a job to do with a RegEx. In Java, it is so much simpler to write some custom code: