title: Writing a regex to detect repeat-characters
body: <p>I need to write a regex, that would identify a word that have a <strong>repeating character set</strong> at the <strong>end</strong>. According to the following code fragment, the repeating character set is <code>An</code>. I need to write a regex so this will be spotted and displayed.</p>
  
  <p>According to the following code, <code>\\w</code> will match any word character (including digit, letter, or special character). But i only want to identify english characters.</p>
  
  <pre><code>String stringToMatch = "IranAnAn";
  Pattern p = Pattern.compile("(\\w)\\1+");
  Matcher m = p.matcher(stringToMatch);
  if (m.find())
  {
      System.out.println("Word contains duplicate characters " + m.group(1));
  }
  </code></pre>
  
  <p>UPDATE</p>
  
  <pre><code>Word contains duplicate characters a
  Word contains duplicate characters a
  Word contains duplicate characters An
  </code></pre>