private static boolean matchDotRegularExpression(String word, String pattern) {
    if (Math.abs(word.length() - pattern.length()) > 1) {
      return false;
    } else if (word.isEmpty() && pattern.isEmpty()) {
      return true;
    } else if (pattern.charAt(0) == '.') {
      return matchDotRegularExpression(word.substring(1), pattern.substring(1));
    } else {
      boolean partialMatch = word.charAt(0) == pattern.charAt(0);
      return partialMatch && matchDotRegularExpression(word.substring(1), pattern.substring(1));
    }
  }
The complexity order of this recursive algorithm is O(N) where N is the number of letters in
the word.
src/main/java/com/github/pedrovgs/problem34/DotRegularExpression.java