code: public static Predicate<MailMessage> forSubject(final Pattern subjectPattern) {
  		return new Predicate<MailMessage>() {
  			@Override
  			public boolean apply(final MailMessage input) {
  				return subjectPattern.matcher(input.getSubject()).matches();
  			}
  
  			@Override
  			public String toString() {
  				return String.format("subject to match pattern '%s'", subjectPattern);
  			}
  		};
  	}
docs: Creates a {@link Predicate} for matching the subject only.
  
  @param subjectPattern
  the regex pattern to match
  @return the predicate