code: public static TregexPattern safeCompile(String tregex, boolean verbose) {
      TregexPattern result = null;
      try {
        result = TregexPatternCompiler.defaultCompiler.compile(tregex);
      } catch (TregexParseException ex) {
        if (verbose) {
          System.err.println("Could not parse " + tregex + ":");
          ex.printStackTrace();
        }
      }
      return result;
    }
docs: Creates a pattern from the given string using the default HeadFinder and
  BasicCategoryFunction.  If you want to use a different HeadFinder or
  BasicCategoryFunction, use a {@link TregexPatternCompiler} object.
  Rather than throwing an exception when the string does not parse,
  simply returns null
  
  @param tregex the pattern string
  @param verbose whether to log errors when the string doesn't parse
  @return a TregexPattern for the string, or null if the string does not parse.