code: public static Pattern getPattern(String patternStr) {
  
          if (patternStr == null) {
              throw new IllegalArgumentException();
          }
  
          int startIndex = 0;
          int endIndex = patternStr.length();
          StringBuffer buffer = new StringBuffer("");
          while (startIndex < endIndex) {
              int star = patternStr.indexOf(WILDCARD, startIndex);
              if (star == -1) {
                  star = endIndex;
                  String preStr = patternStr.substring(startIndex, star);
                  buffer = buffer.append(preStr);
              } else {
                  String preStr = patternStr.substring(startIndex, star);
                  buffer = buffer.append(preStr).append(WILDCARD_PATTERN);
              }
              startIndex = star + 1;
          }
  
          String tmpPatternStr = buffer.toString();
  
          startIndex = 0;
          endIndex = tmpPatternStr.length();
          buffer = new StringBuffer("");
          while (startIndex < endIndex) {
              int qMark = tmpPatternStr.indexOf(SINGLE_CHAR, startIndex);
              if (qMark == -1) {
                  qMark = endIndex;
                  String preStr = tmpPatternStr.substring(startIndex, qMark);
                  buffer = buffer.append(preStr);
              } else {
                  String preStr = tmpPatternStr.substring(startIndex, qMark);
                  buffer = buffer.append(preStr).append(SINGLE_PATTERN);
              }
              startIndex = qMark + 1;
          }
          tmpPatternStr = buffer.toString();
  
          LogFactory.getLog(SigningPolicyParser.class.getCanonicalName()).debug("String with replaced pattern is " + tmpPatternStr);
  
          return Pattern.compile(tmpPatternStr, Pattern.CASE_INSENSITIVE);
      }
docs: Method that takes a pattern string as described in the signing policy
  file with * for zero or many characters and ? for single character, and
  converts it into java.util.regexp.Pattern object. This requires replacing
  the wildcard characters with equivalent expression in regexp grammar.
  
  @param patternStr Pattern string as described in the signing policy file
  with for zero or many characters and ? for single
  character
  @return Pattern object with the expression equivalent to patternStr.