code: public static Pattern compile(String pattern) throws IllegalArgumentException {
          if (pattern == null) {
              throw new IllegalArgumentException("Pattern can not be null");
          }
  
          if (pattern.startsWith("/") && pattern.endsWith("/") && pattern.length() > 1) {
              // This is a regular expression
              // So create matcher as is
              try {
                  return Pattern.compile(pattern.substring(1, pattern.length() - 1));
              } catch (PatternSyntaxException e) {
                  throw new IllegalArgumentException("Pattern contains an invalid expression", e);
              }
          }
  
          StringBuilder rEPattern = new StringBuilder("^");
  
          for (int i = 0; i < pattern.length(); i++) {
              if (pattern.charAt(i) == '*')
                  rEPattern.append('.');
              if (pattern.charAt(i) == '?') {
                  rEPattern.append('.');
              } else {
                  rEPattern.append(pattern.charAt(i));
              }
          }
  
          rEPattern.append("$");
  
          try {
              return Pattern.compile(rEPattern.toString());
          } catch (PatternSyntaxException e) {
              throw new IllegalArgumentException("Pattern contains an invalid expression", e);
          }
      }
docs: compiles pattern string into regular expression Pattern object.
  
  @param pattern string containing WebSphere console specific pattern
  @return compiled version of the string
  @throws IllegalArgumentException if pattern is null or contains an illegal pattern.