1Validation::Class::DireUcsteirveC:o:nPtartitbeurtne(d3V)PaelrildaDtoicounm:e:nCtlaatsiso:n:Directive::Pattern(3)
2
3
4
6 Validation::Class::Directive::Pattern - Pattern Directive for
7 Validation Class Field Definitions
8
10 version 7.900059
11
13 use Validation::Class::Simple;
14
15 my $rules = Validation::Class::Simple->new(
16 fields => {
17 company_email => {
18 pattern => qr/\@company\.com$/
19 }
20 }
21 );
22
23 # set parameters to be validated
24 $rules->params->add($parameters);
25
26 # validate
27 unless ($rules->validate) {
28 # handle the failures
29 }
30
32 Validation::Class::Directive::Pattern is a core validation class field
33 directive that validates simple patterns and complex regular
34 expressions.
35
36 • alternative argument: an-array-of-something
37
38 This directive can be passed a regexp object or a simple
39 pattern. A simple pattern is a string where the `#` character
40 matches digits and the `X` character matches alphabetic
41 characters.
42
43 fields => {
44 task_date => {
45 pattern => '##-##-####'
46 },
47 task_time => {
48 pattern => '##:##:##'
49 }
50 }
51
53 Al Newkirk <anewkirk@ana.io>
54
56 This software is copyright (c) 2011 by Al Newkirk.
57
58 This is free software; you can redistribute it and/or modify it under
59 the same terms as the Perl 5 programming language system itself.
60
61
62
63perl v5.36.0 2023-V0a4l-i0d3ation::Class::Directive::Pattern(3)