code: private static void checkPattern(String s) throws ProblemException {
          // Package names like foo.bar.gamma are allowed, and
          // package names suffixed with .* like foo.bar.* are
          // also allowed.
          Pattern p = Pattern.compile("[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+");
          Matcher m = p.matcher(s);
          if (!m.matches()) {
              throw new ProblemException("The string \""+s+"\" is not a proper package name pattern.");
          }
      }
docs: Verify that a package pattern is valid.