code: public static Pattern atMost(final int max, final CharPredicate predicate) {
      Checks.checkMax(max);
      return new Pattern() {
        @Override
        public int match(CharSequence src, int begin, int end) {
          return matchSome(max, predicate, src, end, begin, 0);
        }
      };
    }
docs: Returns a {@link Pattern} that matches up to {@code max} number of characters satisfying
  {@code predicate}.
  @since 2.2