Kernel::System::DataValidation::Validator::Pattern

NAME

Kernel::System::DataValidation::Validator::Pattern – Validator that executes regex patterns on a value.

PUBLIC INTERFACE

Provides a Check method, that will be called by the Kernel::System::DataValidation backend.

Check()

Executes regular expressions on the given values. The patterns needs to be passed as the Arguments parameter.

    my $True = $Validator->Check(
        Arguments => [ '.*', '^\w+$' ],
        Value     => 'MyValue',
    );

    my $False = $Validator->Check(
        Arguments => [ '^\d+$' ],
        Value     => 'MyValue',
    );

    my $True = $Validator->Check(
        Arguments => {
            Pattern      => [ '.*', '^\w+$' ],
            ErrorMessage => 'Please provide a word value.',
        },
        Value => 'MyValue',
    );
Scroll to Top