title: Find words with repeating characters
body: <p>Want search every word in a dictionary what has the same character exactly at the second and last positon, and one times somewhere middle.</p>
  
  <p>examples:</p>
  
  <pre><code>statement - has the "t" at the second, fourth and last place
  severe = has "e" at 2,4,last
  abbxb = "b" at 2,3,last
  </code></pre>
  
  <p>wrong</p>
  
  <pre><code>abab = "b" only 2 times not 3
  abxxxbyyybzzzzb - "b" 4 times, not 3
  </code></pre>
  
  <p>my grep is not working</p>
  
  <pre><code>my @ok = grep { /^(.)(.)[^\2]+(\2)[^\2]+(\2)$/ } @wordlist;
  </code></pre>
  
  <p>e.g. the</p>
  
  <pre><code>perl -nle 'print if /^(.)(.)[^\2]+(\2)[^\2]+(\2)$/' &lt; /usr/share/dict/words
  </code></pre>
  
  <p>prints for example the</p>
  
  <pre><code>zarabanda
  </code></pre>
  
  <p>what is wrong.</p>
  
  <p>What should be the correct regex?</p>
  
  <p>EDIT:</p>
  
  <p>And how to i can capture the enclosed groups? e.g. for the</p>
  
  <pre><code>statement - want cantupre: st(a)t(emen)t - for the later use
  
  my $w1 = $1; my w2 = $2; or something like...
  </code></pre>