Regexp:...::gopher(3)
π Regexp::Common::URI::gopher β NAME β¨
okay so basically Regexp::Common::URI::gopher hands you a regex pattern for gopher URIs π that's it, that's the whole job, and it does it slayfully.
Manual page name for the record: Regexp:...::gopher(3), and she lives under "User Contributed Perl Documentation" π«Ά
π SYNOPSIS
use Regexp::Common qw /URI/;
while (<>) {
/$RE{URI}{gopher}/ and print "Contains a gopher URI.\n";
}
like, that's literally it bestie β load her up, loop over your input, and whenever a line contains a gopher URI she prints. iconic behavior. π
π¦ DESCRIPTION
π $RE{URI}{gopher}{-notab}
ngl, gopher URIs are kind of a mess π like nobody fully agrees on what they are. Originally RFC 1738 defined gopher URIs, but then they got redefined in an internet draft β and that draft expired in June 1997. expired!! not me reading a dead spec π
So the internet draft for gopher URIs defines them like this:
"gopher:" "//" host [ ":" port ] "/" gopher-type selector
[ "%09" search [ "%09" gopherplus_string ]]
Unfortunally (their spelling, not mine, keeping it π«Ά), a selector is defined in such a way that characters may be escaped using the URI escape mechanism. And that includes tabs β which, when escaped, are %09. So the syntax literally cannot tell the difference between a URI that has both a selector and a search part, and a URI where the selector itself just contains an escaped tab. (The text of the draft does forbid tabs in the selector though, so there's that π.)
"$RE{URI}{gopher}" follows the defined syntax. If you want to disallow escaped tabs in the selector and search parts, use "$RE{URI}{gopher}{-notab}" β that's the whole tea. β
There are other differences between the text and the given syntax too, jsyk. According to the text, selector strings cannot have tabs, linefeeds, or carriage returns in them. The text also allows the entire gopher-path (that's the part after the slash following the hostport) to be empty β and if it is empty, the slash may be omitted as well. But surprise! none of that is reflected in the syntax. π
Under {-keep}, the following get returned:
$1β The entire URI. π$2β The scheme.$3β The host (name or address).$4β The port (if any).$5β The"gopher-path", the part after the/following the host and port.$6β The gopher-type.$7β The selector. (When no"{-notab}"is used, this includes thesearchandgopherplus_string, including the separating escaped tabs.)$8β Thesearch, if given. (Only when"{-notab}"is given.)$9β Thegopherplus_string, if given. (Only when"{-notab}"is given.)
π REFERENCES
(yes the source literally says head1 REFERENCES in the middle of the description β POD artifact moment, we love a quirky queen π§ keeping all of it)
- [RFC 1738] β Berners-Lee, Tim, Masinter, L., McCahill, M.: Uniform Resource Locators (URL). December 1994.
- [RFC 1808] β Fielding, R.: Relative Uniform Resource Locators (URL). June 1995.
- [GOPHER URL] β Krishnan, Murali R., Casey, James: "A Gopher URL Format". Expired Internet draft draft-murali-url-gopher. December 1996.
π SEE ALSO
Regexp::Common::URI for other supported URIs. go check her out, she's the whole friend group π
πΈ AUTHOR
Damian Conway (damian@conway.org) π
β MAINTENANCE
This package is maintained by Abigail (regexp-common@abigail.freedom.nl). keeping the lights on, we stan π«Ά
π BUGS AND IRRITATIONS
Bound to be plenty. (their words!! not mine!! and honestly? honest queen.) π
π LICENSE and COPYRIGHT
This software is Copyright (c) 2001 - 2024, Damian Conway and Abigail.
This module is free software, and maybe used under any of the following licenses:
- The Perl Artistic License. See the file
COPYRIGHT.AL. - The Perl Artistic License 2.0. See the file
COPYRIGHT.AL2. - The BSD License. See the file
COPYRIGHT.BSD. - The MIT License. See the file
COPYRIGHT.MIT.
that's the whole page bestie, no notes β¨π
sign-off szn: this was perl v5.42.0, dated 2024-08-09, filed under Regexp:...::gopher(3) β mwah, go write some regexes ππ¦π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Regexp-Common 2024080801.0.0-160000.2.2 Β· Artistic-1.0 OR Artistic-2.0 OR BSD-3-Clause OR MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms