title: Regex: At least 2 symbols or numbers (or mixed) in Java
body: <p>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).</p>
  
  <p>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 <code>[-+_!@#$%^&amp;*.,?]</code>.</p>
  
  <p>So I've come up with something like this so far: <code>^(?=.{8,})(?=.*\d{2,}).*$</code>, but I can't understand how to put the symbols sequence in the <code>\d</code> part. Oh, I'm not sure if (?=) does work for Java, does it? This <a href="http://www.rubular.com/r/VC0ncbDlRl" rel="nofollow">rubular.com/r/VC0ncbDlRl</a> made writing regex little easier.</p>