Valida...Pattern(3pm)

πŸ“¦
version 7.900059 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, so Validation::Class::Directive::Pattern is the Pattern Directive for Validation Class field definitions. that's it, that's the whole vibe. she validates patterns. periodt. πŸŽ€


✨ VERSION ✨

this one's rocking version 7.900059 πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's how you actually use her, no cap:

use Validation::Class::Simple;

my $rules = Validation::Class::Simple->new(
    fields => {
        company_email => {
            pattern => qr/\@company\.com$/
        }
    }
);

# set parameters to be validated
$rules->params->add($parameters);

# validate
unless ($rules->validate) {
    # handle the failures
}

like, you set the params, you validate, and if it flops you deal with the failures. simple as that, fr fr 🫢


🌸 DESCRIPTION 🌸

Validation::Class::Directive::Pattern is a core validation class field directive that validates simple patterns and complex regular expressions. she's not picky, she does both. versatile queen. πŸ‘‘

  • alternative argument: an-array-of-something

so you can pass this directive either a regexp object OR a simple pattern. and what's a simple pattern, you ask? it's a string where the # character matches digits and the X character matches alphabetic characters. iykyk πŸ’«

so like:

fields => {
    task_date => {
        pattern => '##-##-####'
    },
    task_time => {
        pattern => '##:##:##'
    }
}

see how ##-##-#### is giving date and ##:##:## is giving time? the #s are your lil digit placeholders. it's literally that easy bestie 🌈


πŸ’œ AUTHOR πŸ’œ

Al Newkirk <anewkirk@ana.io> β€” the icon, the legend, the main character who wrote this ✨


This software is copyright (c) 2011 by Al Newkirk.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so go off, remix her, just keep it legal bestie πŸ’–


and that's the whole page! perl v5.36.0 did the formatting, dated 2023-06-11, and the page herself is Valida...Pattern(3pm). mwah, go validate something cute πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from