{
    "mode": "perldoc",
    "parameter": "Regexp::Common::URI::ftp",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Regexp%3A%3ACommon%3A%3AURI%3A%3Aftp/json",
    "generated": "2026-06-09T11:54:41Z",
    "synopsis": "use Regexp::Common qw /URI/;\nwhile (<>) {\n/$RE{URI}{FTP}/       and  print \"Contains an FTP URI.\\n\";\n}",
    "sections": {
        "NAME": {
            "content": "Regexp::Common::URI::ftp -- Returns a pattern for FTP URIs.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Regexp::Common qw /URI/;\n\nwhile (<>) {\n/$RE{URI}{FTP}/       and  print \"Contains an FTP URI.\\n\";\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "$RE{URI}{FTP}{-type}{-password};\nReturns a regex for FTP URIs. Note: FTP URIs are not formally defined. RFC 1738 defines FTP\nURLs, but parts of that RFC have been obsoleted by RFC 2396. However, the differences between\nRFC 1738 and RFC 2396 are such that they aren't applicable straightforwardly to FTP URIs.\n\nThere are two main problems:\n\nPasswords.\nRFC 1738 allowed an optional username and an optional password (separated by a colon) in the\nFTP URL. Hence, colons were not allowed in either the username or the password. RFC 2396\nstrongly recommends passwords should not be used in URIs. It does allow for *userinfo*\ninstead. This userinfo part may contain colons, and hence contain more than one colon. The\nregexp returned follows the RFC 2396 specification, unless the *{-password}* option is\ngiven; then the regex allows for an optional username and password, separated by a colon.\n\nThe ;type specifier.\nRFC 1738 does not allow semi-colons in FTP path names, because a semi-colon is a reserved\ncharacter for FTP URIs. The semi-colon is used to separate the path from the option *type*\nspecifier. However, in RFC 2396, paths consist of slash separated segments, and each segment\nis a semi-colon separated group of parameters. Straigthforward application of RFC 2396 would\nmean that a trailing *type* specifier couldn't be distinguished from the last segment of the\npath having a two parameters, the last one starting with *type=*. Therefore we have opted to\ndisallow a semi-colon in the path part of an FTP URI.\n\nFurthermore, RFC 1738 allows three values for the type specifier, *A*, *I* and *D* (either\nupper case or lower case). However, the internet draft about FTP URIs [DRAFT-FTP-URL] (which\nexpired in May 1997) notes the lack of consistent implementation of the *D* parameter and\ndrops *D* from the set of possible values. We follow this practise; however, RFC 1738\nbehaviour can be archieved by using the *-type =* \"[ADIadi]\"> parameter.\n\nFTP URIs have the following syntax:\n\n\"ftp:\" \"//\" [ userinfo \"@\" ] host [ \":\" port ]\n[ \"/\" path [ \";type=\" value ]]\n\nWhen using *{-password}*, we have the syntax:\n\n\"ftp:\" \"//\" [ user [ \":\" password ] \"@\" ] host [ \":\" port ]\n[ \"/\" path [ \";type=\" value ]]\n\nUnder \"{-keep}\", the following are returned:\n\n$1  The complete URI.\n\n$2  The scheme.\n\n$3  The userinfo, or if *{-password}* is used, the username.\n\n$4  If *{-password}* is used, the password, else \"undef\".\n\n$5  The hostname or IP address.\n\n$6  The port number.\n\n$7  The full path and type specification, including the leading slash.\n\n$8  The full path and type specification, without the leading slash.\n\n$9  The full path, without the type specification nor the leading slash.\n\n$10 The value of the type specification.\n",
            "subsections": []
        },
        "REFERENCES": {
            "content": "[DRAFT-URL-FTP]\nCasey, James: *A FTP URL Format*. November 1996.\n\n[RFC 1738]\nBerners-Lee, Tim, Masinter, L., McCahill, M.: *Uniform Resource Locators (URL)*. December\n1994.\n\n[RFC 2396]\nBerners-Lee, Tim, Fielding, R., and Masinter, L.: *Uniform Resource Identifiers (URI):\nGeneric Syntax*. August 1998.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Regexp::Common::URI for other supported URIs.\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\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": []
        }
    },
    "summary": "Regexp::Common::URI::ftp -- Returns a pattern for FTP URIs.",
    "flags": [],
    "examples": [],
    "see_also": []
}