code: private static Pattern compilePattern( String regex, Logger logger ) {
      try {
        return Pattern.compile(regex);
      }
      catch( PatternSyntaxException pse ) {
        logger.error("Could not compile regex "+regex, pse);
      }
      return null;
    }
docs: Compiles the given regex.  Returns null if the pattern could not be compiled and logs an error message to the
  specified logger.
  
  @param regex the regular expression to compile.
  @param logger the logger to notify of errors.
  @return The compiled regular expression, or null if it could not be compiled.