private static boolean matchAsteriskRegularExpression(String word, String pattern) {
    if (word.isEmpty() && pattern.isEmpty()) {
      return true;
    } else if (word.isEmpty() || pattern.isEmpty()) {
      return false;
    } else if (pattern.charAt(0) == '*') {
      boolean matchRestOfWord = matchAsteriskRegularExpression(word.substring(1), pattern);
      boolean matchRestOfPattern = matchAsteriskRegularExpression(word, pattern.substring(1));
      return matchRestOfWord || matchRestOfPattern;
    } else {
      boolean partialMatch = word.charAt(0) == pattern.charAt(0);
      return partialMatch && matchAsteriskRegularExpression(word.substring(1),
          pattern.substring(1));
    }
  }
The complexity order of this algorithm is more than O(N) but I don't know how to calculate it
using this recursive version. Is O(N) approximately.
src/main/java/com/github/pedrovgs/problem35/AsteriskRegularExpression.java