title: Regex, Difference between ^[a-zA-Z]+$ vs [a-zA-Z]*
body: <p>I'm very new to programming and I've been told to avoid regex for now, but I find it extremely helpful.</p>
  
  <p>When writing a program to check if a string only contains letters, I found on stackoverlow that both <code>^[a-zA-Z]+$</code> and <code>[a-zA-Z]*</code> yield the same results. I understand how <code>[a-zA-Z]</code> works and I understand how <code>[A-z]</code>is different from both of those as well, but I do not understand +$ vs ^[]* or why they yield the same result and I'm having trouble finding anything to explain it.</p>
  
  <p>Here's the example I used it in:</p>
  
  <pre><code>String student = input.next();
  while (!student.matches("[a-zA-Z]*")) {
     System.out.print("Invalid input. Enter name: ");
     student = input.next();
  }
  </code></pre>
  
  <p>This is my first question here so sorry if this kind of question is frowned upon.</p>