title: Java regex matcher not working
body: <p>Im trying to get the hang of pattern and matcher. This method should use the regex pattern to iterate over an array of state capitals and return the state or states that correspond to the pattern. The method works fine when I check for whole strings like "tallahassee" or "salt lake city" but not for something like "^t" what is it that im not getting?</p>
  
  <p>This is the method and main that calls it:</p>
  
  <pre><code>public ArrayList&lt;String&gt; getState(String s) throws RemoteException 
  {
      Pattern pattern = Pattern.compile(s);
      Matcher matcher; 
      int i=0;
      System.out.println(s);
      for(String ct:capitalValues)
      {
          matcher = pattern.matcher(ct);
          if(ct.toLowerCase().matches(s))
              states.add(stateValues[i]);
          i++;    
      }
      return states;
  }
  
  public static void main (String[] args) throws RemoteException
  {
      ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;();
      hashTester ht = new hashTester();
  
      result = ht.getState(("^t").toLowerCase());
      System.out.println("result: ");
      for(String s:result)
          System.out.println(s);
  
  
  }
  </code></pre>
  
  <p>thanks for your help</p>