...
Validation Type | Arguments | Description | Example |
---|---|---|---|
int | [ min, max ] | The property value must be an integer. If min is set, the property must be equal to or greater than the min. If max is set, the property must be less than or equal to the max. If min or max is set to undef , then no limiting is enforced | between 0 and 50, incl: 'int' => [ 0, 50 ] non-negative integer: 'int' => [ 0, undef ] |
int-or-empty | [ min, max ] | Available in NMIS 8.6.3G and newer. Like | |
float | [ min, max, above, below ] | The property value must be a floating point number undef are skipped. | between 0 and 1, incl: 'float' => [ 0, 1, undef, undef ] greater than 0.1: [ undef, undef, 0.1, undef ] |
float-or-empty | [ min, max, above, below ] | Available in NMIS 8.6.3G and newer. Like | |
regex | a Perl regular expression given in qr/..../ format | The property value must be matched by the regular expression. | a blank string or a +HH:MM/-HH:MM timezone: 'regex' => qr/^([+-]?\d{1,2}(:\d{1,2})?)?$/ |
regex-or-empty | a Perl regular expression given in qr/..../ format | Available in NMIS 8.6.7G and newer. The property value must either be empty or match the given regular expression. | |
ip | [ acceptable IP versions ] | The property must be a valid IP address. The rule argument sets which IP versions are acceptable; it can contain 4, 6 or both. | any IP address: 'ip' => [ 4, 6 ] an IP V4 address: 'ip' => [ 4 ] |
resolvable | [ acceptabe IP versions ] | The property must be either a valid IP address, or it must be resolvable to a valid IP address (at the time of validation). Resolving is performed using the normal system mechanisms, ie. whatever combination of DNS and /etc/hosts is setup using nsswitch . | something with an IP V4 address: 'resolvable' => [ 4 ] something that resolves to an IP address: 'resolvable' => [ 4, 6 ] |
onefromlist | [ list of acceptable values ] or undef | The property value must be one of the given explicit values, or one of the default display values if no values are given in this rule. | exactly one of the values that was presented visually using value : 'onefromlist' => undefone of these: 'onefromlist' => [ 'yes', 'no', 'maybe' ] |
multifromlist | [ list of acceptable values ] or undef | Like onefromlist , but accepts multiple values from the accepted list. No values whatsoever does satisfy this validation rule. | zero or more of the presented values: 'multifromlist' => undef zero or more of these values: 'multifromlist' => [ 1, 2, 3, 4, 'OMGitsfulllofstars' ] |
...