Regexp::IPv4 - Regular expression for IPv4 addresses
This document describes version 0.003 of Regexp::IPv4 (from Perl distribution Regexp-IPv4), released on 2016-10-18.
use Regexp::IPv4 qw($IPv4_re); $address =~ /^$IPv4_re$/ and print "IPv4 address\n";
The regex only recognizes the quad-dotted notation of four decimal integers, ranging from 0 to 255 each. Other notations like 32-bit hexadecimal number (e.g. 0xFF0000) or shortened dotted notation (e.g. 255.0.0) are not recognized.
If you do not use anchor, beware of cases like:
"255.255.255.256" =~ /($IPv4_re)/; # true & capture "255.255.255.25"
Please visit the project's homepage at https://metacpan.org/release/Regexp-IPv4.
Source repository is at https://github.com/perlancar/perl-Regexp-IPv4.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-IPv4
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
This software is copyright (c) 2016 by email@example.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.