The strict CIDR validation mode checks whether the input string is a genuinely valid CIDR,
ruling out unmatching prefixes. For example, the (potential) CIDR 192.168.0.1/24 is
inaccurate in that the prefix 192.168.0.1 should instead be 192.168.0.0 for the bit
length of 24.
Without the validation mode on, IPUtil.isIP('192.168.0.1/24', true) still returns true. But
with it on, the relevant method will return a corrected CIDR as a string instead of a boolean
if the input string is potentially valid as a CIDR but is inaccurate:
The strict CIDR validation mode checks whether the input string is a genuinely valid CIDR, ruling out unmatching prefixes. For example, the (potential) CIDR
192.168.0.1/24
is inaccurate in that the prefix192.168.0.1
should instead be192.168.0.0
for the bit length of24
.Without the validation mode on,
IPUtil.isIP('192.168.0.1/24', true)
still returnstrue
. But with it on, the relevant method will return a corrected CIDR as a string instead of a boolean if the input string is potentially valid as a CIDR but is inaccurate: