docs: private static CompareType getCompareType( String expression ) {
          CompareType result = CompareType.EQ;
  
          CharacterIterator iter = new StringCharacterIterator(expression);
          final int fistIndex = 0;
          final int lastIndex = expression.length() - 1;
          boolean skipNext = false;
          for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
              if (skipNext) {
                  skipNext = false;
                  continue;
              }
              if (c == '_') {
                  return CompareType.REGEXP;
              }
              if (c == '%') {
                  if (result != CompareType.EQ) {
                      // pattern like '%abcdfe%' -> only regexp can handle this;
                      return CompareType.REGEXP;
                  }
  
                  int index = iter.getIndex();
                  if (index == fistIndex) {
                      result = CompareType.ENDS_WITH;
                  } else if (index == lastIndex) {
                      result = CompareType.STARTS_WITH;
                  } else {
                      return CompareType.REGEXP;
                  }
              }
  
              if (c == '\\') skipNext = true;
          }
  
          return result;
      }