title: String must contain only [a-zA-Z0-9_] symbols (may be from one letter but not "_"), start not from digit
body: <p>I'm solving a problem in Java and need to make a regexp, which checks the string for the next rules:</p>
  
  <ol>
  <li>the string must contain only digits, uppercase and lowercase letters and underscore character <code>"_"</code>;</li>
  <li>the string must not start from digit;</li>
  <li>if the string starts from underscore, the second character must be not underscore, i.e it must be a digit or a letter;</li>
  <li>the string may consist only from one character but this character must not be an underscore;</li>
  </ol>
  
  <p>I do not understand how to make the first part of regexp. I tried to make it part by part:</p>
  
  <ol>
  <li>Expression <code>"_[a-zA-Z0-9]"</code> satisfies the condition "If string starts from underscore character then the second character is a letter or digit".</li>
  <li>Expression <code>"\\D"</code> satisfies the condition "String must not start from a digit".</li>
  <li>Expression <code>"[a-zA-Z]"</code> satisfies the condition "String starts from an uppercase or lowercase letter".</li>
  </ol>
  
  <p>The last part of expression is simple - <code>"w*"</code>.</p>
  
  <p>When I try to put all this together <code>"(_[a-zA-Z0-9])*|(\\D)*|([a-zA-Z])*w*"</code>, the obtained regexp does not work properly.</p>
  
  <p>The following strings <code>b33</code> and <code>_n1</code> do not fit for my regexp but the string <code>__</code> fits to it.</p>
  
  <p>How to fix my regexp?</p>