This pattern ought to do the trick
\b\w*?(\w{2})\w*?\1\w*?\b
\b
is a word boundry
\w*?
some number of letters (lazily)
(w{2})
exactly two letters, match and capture
\w*?
same as above
\1
the content of our two letter capture group
\w*?
same as above
\b
another word boundry
A quick test in java:
public static void main(String[] args) {
final Pattern pattern = Pattern.compile("\\b\\w*?(\\w{2})\\w*?\\1\\w*?\\b");
final String string = "tatarak brzozowski loremipsrecdks a word that does not match";
final Matcher matcher = pattern.matcher(string);
while(matcher.find()) {
System.out.println("Found group " + matcher.group(1) + " in word " + matcher.group());
}
}
Output
Found group ta in word tatarak
Found group zo in word brzozowski
Found group re in word loremipsrecdks