{
    "content": [
        {
            "type": "text",
            "text": "# Regexp::Common::net (perldoc)\n\n## NAME\n\nRegexp::Common::net -- provide regexes for IPv4, IPv6, and MAC addresses.\n\n## SYNOPSIS\n\nuse Regexp::Common qw /net/;\nwhile (<>) {\n/$RE{net}{IPv4}/       and print \"Dotted decimal IP address\";\n/$RE{net}{IPv4}{hex}/  and print \"Dotted hexadecimal IP address\";\n/$RE{net}{IPv4}{oct}{-sep => ':'}/ and\nprint \"Colon separated octal IP address\";\n/$RE{net}{IPv4}{bin}/  and print \"Dotted binary IP address\";\n/$RE{net}{MAC}/        and print \"MAC address\";\n/$RE{net}{MAC}{oct}{-sep => \" \"}/ and\nprint \"Space separated octal MAC address\";\n}\n\n## DESCRIPTION\n\nPlease consult the manual of Regexp::Common for a general description of the works of this\ninterface.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **REFERENCES**\n- **SEE ALSO**\n- **AUTHOR**\n- **MAINTENANCE**\n- **BUGS AND IRRITATIONS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Regexp::Common::net",
        "section": "",
        "mode": "perldoc",
        "summary": "Regexp::Common::net -- provide regexes for IPv4, IPv6, and MAC addresses.",
        "synopsis": "use Regexp::Common qw /net/;\nwhile (<>) {\n/$RE{net}{IPv4}/       and print \"Dotted decimal IP address\";\n/$RE{net}{IPv4}{hex}/  and print \"Dotted hexadecimal IP address\";\n/$RE{net}{IPv4}{oct}{-sep => ':'}/ and\nprint \"Colon separated octal IP address\";\n/$RE{net}{IPv4}{bin}/  and print \"Dotted binary IP address\";\n/$RE{net}{MAC}/        and print \"MAC address\";\n/$RE{net}{MAC}{oct}{-sep => \" \"}/ and\nprint \"Space separated octal MAC address\";\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 149,
                "subsections": []
            },
            {
                "name": "REFERENCES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MAINTENANCE",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "BUGS AND IRRITATIONS",
                "lines": 14,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Regexp::Common::net -- provide regexes for IPv4, IPv6, and MAC addresses.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Regexp::Common qw /net/;\n\nwhile (<>) {\n/$RE{net}{IPv4}/       and print \"Dotted decimal IP address\";\n/$RE{net}{IPv4}{hex}/  and print \"Dotted hexadecimal IP address\";\n/$RE{net}{IPv4}{oct}{-sep => ':'}/ and\nprint \"Colon separated octal IP address\";\n/$RE{net}{IPv4}{bin}/  and print \"Dotted binary IP address\";\n/$RE{net}{MAC}/        and print \"MAC address\";\n/$RE{net}{MAC}{oct}{-sep => \" \"}/ and\nprint \"Space separated octal MAC address\";\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Please consult the manual of Regexp::Common for a general description of the works of this\ninterface.\n\nDo not use this module directly, but load it via *Regexp::Common*.\n\nThis modules gives you regular expressions for various style IPv4, IPv6, and MAC (or ethernet)\naddresses.\n\n$RE{net}{IPv4}\nReturns a pattern that matches a valid IP address in \"dotted decimal\". Note that while\n318.99.183.11 is not a valid IP address, it does match \"/$RE{net}{IPv4}/\", but this is because\n318.99.183.11 contains a valid IP address, namely 18.99.183.11. To prevent the unwanted\nmatching, one needs to anchor the regexp: \"/^$RE{net}{IPv4}$/\".\n\nFor this pattern and the next four, under \"-keep\" (See Regexp::Common):\n\n$1  captures the entire match\n\n$2  captures the first component of the address\n\n$3  captures the second component of the address\n\n$4  captures the third component of the address\n\n$5  captures the final component of the address\n\n$RE{net}{IPv4}{dec}{-sep}\nReturns a pattern that matches a valid IP address in \"dotted decimal\". Leading 0s are allowed,\nas long as each component does not exceed 3 digits.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is\n\"qr/[.]/\".\n\n$RE{net}{IPv4}{strict}{-sep}\nReturns a pattern that matches a valid IP address in \"dotted decimal\", but disallow any leading\n0s.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is\n\"qr/[.]/\".\n\n$RE{net}{IPv4}{hex}{-sep}\nReturns a pattern that matches a valid IP address in \"dotted hexadecimal\", with the letters \"A\"\nto \"F\" capitalized.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is\n\"qr/[.]/\". \"-sep=\"\"\" and \"-sep=\" \"\" are useful alternatives.\n\n$RE{net}{IPv4}{oct}{-sep}\nReturns a pattern that matches a valid IP address in \"dotted octal\"\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is\n\"qr/[.]/\".\n\n$RE{net}{IPv4}{bin}{-sep}\nReturns a pattern that matches a valid IP address in \"dotted binary\"\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is\n\"qr/[.]/\".\n\n$RE{net}{MAC}\nReturns a pattern that matches a valid MAC or ethernet address as colon separated hexadecimals.\n\nFor this pattern, and the next four, under \"-keep\" (See Regexp::Common):\n\n$1  captures the entire match\n\n$2  captures the first component of the address\n\n$3  captures the second component of the address\n\n$4  captures the third component of the address\n\n$5  captures the fourth component of the address\n\n$6  captures the fifth component of the address\n\n$7  captures the sixth and final component of the address\n\nThis pattern, and the next four, have a \"subs\" method as well, which will transform a matching\nMAC address into so called canonical format. Canonical format means that every component of the\naddress will be exactly two hexadecimals (with a leading zero if necessary), and the components\nwill be separated by a colon.\n\n$RE{net}{MAC}{dec}{-sep}\nReturns a pattern that matches a valid MAC address as colon separated decimals.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is \"qr/:/\".\n\n$RE{net}{MAC}{hex}{-sep}\nReturns a pattern that matches a valid MAC address as colon separated hexadecimals, with the\nletters \"a\" to \"f\" in lower case.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is \"qr/:/\".\n\n$RE{net}{MAC}{oct}{-sep}\nReturns a pattern that matches a valid MAC address as colon separated octals.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is \"qr/:/\".\n\n$RE{net}{MAC}{bin}{-sep}\nReturns a pattern that matches a valid MAC address as colon separated binary numbers.\n\nIf \"-sep=*P*\" is specified the pattern *P* is used as the separator. By default *P* is \"qr/:/\".\n\n$RE{net}{IPv6}{-sep => ':'}{-style => 'HeX'}\nReturns a pattern matching IPv6 numbers. An IPv6 address consists of eight groups of four\nhexadecimal digits, separated by colons. In each group, leading zeros may be omitted. Two or\nmore consecutive groups consisting of only zeros may be omitted (including any colons separating\nthem), resulting into two sets of groups, separated by a double colon. (Each of the groups may\nbe empty; \"::\" is a valid address, equal to \"0000:0000:0000:0000:0000:0000:0000:0000\"). The hex\nnumbers may be in either case.\n\nIf the \"-sep\" option is used, its argument is a pattern that matches the separator that\nseparates groups. This defaults to \":\". The \"-style\" option is used to denote which case the hex\nnumbers may be. The default style, 'HeX' indicates both lower case letters 'a' to 'f' and upper\ncase letters 'A' to 'F' will be matched. The style 'HEX' restricts matching to upper case\nletters, and 'hex' only matches lower case letters.\n\nIf \"{-keep}\" is used, $1 to $9 will be set. $1 will be set to the matched address, while $2 to\n$9 will be set to each matched group. If a group is omitted because it contains all zeros, its\nmatching variable will be the empty string.\n\nExample:\n\n\"2001:db8:85a3::8a2e:370:7334\" =~ /$RE{net}{IPv6}{-keep}/;\nprint $2;    # '2001'\nprint $4;    # '85a3'\nprint $6;    # Empty string\nprint $8;    # '370'\n\nPerl 5.10 (or later) is required for this pattern.\n\n$RE{net}{domain}\nReturns a pattern to match domains (and hosts) as defined in RFC 1035. Under I{-keep} only the\nentire domain name is returned.\n\nRFC 1035 says that a single space can be a domainname too. So, the pattern returned by\n$RE{net}{domain} recognizes a single space as well. This is not always what people want. If you\nwant to recognize domainnames, but not a space, you can do one of two things, either use\n\n/(?! )$RE{net}{domain}/\n\nor use the \"{-nospace}\" option (without an argument).\n\nRFC 1035 does not allow host or domain names to start with a digits; however, this restriction\nis relaxed in RFC 1101; this RFC allows host and domain names to start with a digit, as long as\nthe first part of a domain does not look like an IP address. If the \"{-rfc1101}\" option is given\n(as in \"$RE {net} {domain} {-rfc1101}\"), we will match using the relaxed rules.\n",
                "subsections": []
            },
            "REFERENCES": {
                "content": "RFC 1035\nMockapetris, P.: *DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION*. November 1987.\n\nRFC 1101\nMockapetris, P.: *DNS Encoding of Network Names and Other Types*. April 1987.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Regexp::Common for a general description of how to use this interface.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Damian Conway *damian@conway.org*.\n",
                "subsections": []
            },
            "MAINTENANCE": {
                "content": "This package is maintained by Abigail (*regexp-common@abigail.be*).\n",
                "subsections": []
            },
            "BUGS AND IRRITATIONS": {
                "content": "Bound to be plenty.\n\nFor a start, there are many common regexes missing. Send them in to *regexp-common@abigail.be*.\n\nLICENSE and COPYRIGHT\nThis software is Copyright (c) 2001 - 2017, Damian Conway and Abigail.\n\nThis module is free software, and maybe used under any of the following licenses:\n\n1) The Perl Artistic License.     See the file COPYRIGHT.AL.\n2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.\n3) The BSD License.               See the file COPYRIGHT.BSD.\n4) The MIT License.               See the file COPYRIGHT.MIT.\n",
                "subsections": []
            }
        }
    }
}