code: public static boolean isPunct(String s){
      Pattern p = Pattern.compile("^[\\p{Punct}]+$");
      Matcher m = p.matcher(s);
      return m.matches();
    }
docs: Given a String the method uses Regex to check if the String only contains punctuation characters
  
  @param s a String to check using regex
  @return true if the String is valid