title: Java regular expression on matching asterisk only when it is the last character
body: <p>Anyone can spot any error in this code?</p>
  
  <pre><code>    String value = "/files/etc/hosts/*";
      if (value.matches("\\*$")) {
          System.out.println("MATCHES!");
      }
  </code></pre>
  
  <p>I am trying to do some operation when the last character of a string is an asterisk.</p>
  
  <p>The syntax looks correct to me, I tested it on <a href="http://regexpal.com/" rel="nofollow">http://regexpal.com/</a></p>
  
  <p>Thanks in advance!</p>