diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2015-11-30 11:10:57 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2015-11-30 11:10:57 -0700 |
commit | 88a9a314c3e9cccbea5add95081655f2c14ec4c1 (patch) | |
tree | cbffd59acccea8aebe9178ad76962be90604c49e /README.markdown | |
parent | 06b2cfbf73fd5675d691ed3f44d0fad81f5c821e (diff) | |
parent | fe23e01a4b8b0cc0d9ea1a958e2be5a947fb7aed (diff) |
Merge pull request #546 from jdevesa/validate_ip
Add validator for any IP address
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 9ff242c..526b573 100644 --- a/README.markdown +++ b/README.markdown @@ -1079,6 +1079,39 @@ Validates that the first argument is an integer (or an array of integers). Abort *Type*: statement. +#### `validate_ip_address` + +Validates that argument is an IP address, regardless of it is an IPv4 or an IPv6 +address. It validates as well IP address with netmask. It must be an String, as +well. + +The following values will pass: + + ~~~ + validate_ip_address('0.0.0.0') + validate_ip_address('8.8.8.8') + validate_ip_address('127.0.0.1') + validate_ip_address('194.232.104.150') + validate_ip_address('3ffe:0505:0002::') + validate_ip_address('::1/64') + validate_ip_address('fe80::a00:27ff:fe94:44d6/64') + validate_ip_address('8.8.8.8/32') + ~~~ + +The following values will fail, causing compilation to abort: + + ~~~ + validate_ip_address(1) + validate_ip_address(true) + validate_ip_address(0.0.0.256) + validate_ip_address('::1', {}) + validate_ip_address('0.0.0.0.0') + validate_ip_address('3.3.3') + validate_ip_address('23.43.9.22/64') + validate_ip_address('260.2.32.43') + ~~~ + + #### `validate_numeric` Validates that the first argument is a numeric value (or an array of numeric values). Aborts catalog compilation if any of the checks fail. |