title: How to match letters only using java regex, matches method?
body: <pre><code>import java.util.regex.Pattern;
  
  class HowEasy {
      public boolean matches(String regex) {
          System.out.println(Pattern.matches(regex, "abcABC   "));
          return Pattern.matches(regex, "abcABC");
      }
  
      public static void main(String[] args) {
          HowEasy words = new HowEasy();
          words.matches("[a-zA-Z]");
      }
  }
  </code></pre>
  
  <p>The output is False. Where am I going wrong? Also I want to check if a word contains only letters and may or maynot end with a single period. What is the regex for that?</p>
  
  <p>i.e "abc" "abc." is valid but "abc.." is not valid. </p>
  
  <p>I can use <code>indexOf()</code> method to solve it, but I want to know if it is possible to use a single regex. </p>