@Override
    public @NonNull ArgumentParseResult<Boolean> preprocess(
            final @NonNull CommandContext<C> context,
            final @NonNull CommandInput commandInput
    ) {
        final String head = commandInput.peekString();
        if (this.predicate.test(head)) {
            return ArgumentParseResult.success(true);
        }
        return ArgumentParseResult.failure(
                new RegexValidationException(
                        this.rawPattern,
                        head,
                        this.failureCaption,
                        context
                )
        );
    }
Create a new preprocessor

@param pattern        Regular expression
@param <C>            Command sender type
@param failureCaption Caption sent when the input is invalid
@return Preprocessor instance
cloud-core/src/main/java/org/incendo/cloud/component/preprocessor/RegexPreprocessor.java