in lower case.
If C<< -sep=I >> is specified the pattern I
is used as the separator.
By default I
is C.
=head2 C<$RE{net}{MAC}{oct}{-sep}>
Returns a pattern that matches a valid MAC address as colon separated
octals.
If C<< -sep=I
>> is specified the pattern I
is used as the separator.
By default I
is C.
=head2 C<$RE{net}{MAC}{bin}{-sep}>
Returns a pattern that matches a valid MAC address as colon separated
binary numbers.
If C<< -sep=I
>> is specified the pattern I
is used as the separator.
By default I
is C.
=head2 C<$RE{net}{IPv6}{-sep => ':'}{-style => 'HeX'}>
Returns a pattern matching IPv6 numbers. An IPv6 address consists of
eigth groups of four hexadecimal digits, separated by colons. In each
group, leading zeros may be omitted. Two or more consecutive groups
consisting of only zeros may be omitted (including any colons separating
them), resulting into two sets of groups, separated by a double colon.
(Each of the groups may be empty; C<< :: >> is a valid address, equal to
C<< 0000:0000:0000:0000:0000:0000:0000:0000 >>). The hex numbers may be
in either case.
If the C<< -sep >> option is used, its argument is a pattern that matches
the separator that separates groups. This defaults to C<< : >>. The
C<< -style >> option is used to denote which case the hex numbers may be.
The default style, C<< 'HeX' >> indicates both lower case letters C<< 'a' >>
to C<< 'f' >> and upper case letters C<< 'A' >> to C<< 'F' >> will be
matched. The style C<< 'HEX' >> restricts matching to upper case letters,
and C<< 'hex' >> only matches lower case letters.
If C<< {-keep} >> is used, C<< $1 >> to C<< $9 >> will be set. C<< $1 >>
will be set to the matched address, while C<< $2 >> to C<< $9 >> will be
set to each matched group. If a group is omitted because it contains all
zeros, its matching variable will be the empty string.
Example:
"2001:db8:85a3::8a2e:370:7334" =~ /$RE{net}{IPv6}{-keep}/;
print $2; # '2001'
print $4; # '85a3'
print $6; # Empty string
print $8; # '370'
Perl 5.10 (or later) is required for this pattern.
=head2 C<$RE{net}{domain}>
Returns a pattern to match domains (and hosts) as defined in RFC 1035.
Under I{-keep} only the entire domain name is returned.
RFC 1035 says that a single space can be a domainname too. So, the
pattern returned by C<$RE{net}{domain}> recognizes a single space
as well. This is not always what people want. If you want to recognize
domainnames, but not a space, you can do one of two things, either use
/(?! )$RE{net}{domain}/
or use the C<{-nospace}> option (without an argument).
RFC 1035 does B allow host or domain names to start with a digits;
however, this restriction is relaxed in RFC 1101; this RFC allows host
and domain names to start with a digit, as long as the first part of
a domain does not look like an IP address. If the C<< {-rfc1101} >> option
is given (as in C<< $RE {net} {domain} {-rfc1101} >>), we will match using
the relaxed rules.
=head1 REFERENCES
=over 4
=item B
Mockapetris, P.: I.
November 1987.
=item B
Mockapetris, P.: I.
April 1987.
=back
=head1 SEE ALSO
L for a general description of how to use this interface.
=head1 AUTHOR
Damian Conway I.
=head1 MAINTAINANCE
This package is maintained by Abigail S<(I)>.
=head1 BUGS AND IRRITATIONS
Bound to be plenty.
For a start, there are many common regexes missing.
Send them in to I.
=head1 LICENSE and COPYRIGHT
This software is Copyright (c) 2001 - 2013, Damian Conway and Abigail.
This module is free software, and maybe used under any of the following
licenses:
1) The Perl Artistic License. See the file COPYRIGHT.AL.
2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
3) The BSD Licence. See the file COPYRIGHT.BSD.
4) The MIT Licence. See the file COPYRIGHT.MIT.
=cut