title: How to create a java regular expression pattern that would match a string only at certain positon?
body: <p>I would like to create a regular expression pattern that would succeed in matching <strong>only if</strong> the pattern string not <strong>followed</strong> by any other string in the test string or input string !  Here is what i tried :</p>
  
  <pre><code>      Pattern p = Pattern.compile("google.com");//I want to know the right format
  
        String input1 = "mail.google.com";
        String input2 = "mail.google.com.co.uk";
  
        Matcher m1 = p.matcher(input1);
        Matcher m2 = p.matcher(input2);
  
        boolean found1 = m1.find();
        boolean found2 = m2.find();//This should be false because "google.com" is followed by ".co.uk" in input2 string
  </code></pre>
  
  <p>Any help would be appreciated!</p>