Regexp:...RI::file(3)

✨ NAME ✨

okay so bestie, this is Regexp::Common::URI::file β€” it hands you a pattern for file URIs. that's it, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

like, imagine you just wanna know if your input has a file URI in it:

use Regexp::Common qw /URI/;

while (<>) {
    /$RE{URI}{file}/       and  print "Contains a file URI.\n";
}

slay. it just works 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

$RE{URI}{file}

so this one returns a pattern that matches file URIs, exactly as defined by RFC 1738 β€” no cap, that's the spec. file URIs are giving:

"file:" "//" [ host | "localhost" ] "/" fpath

and when you're running it under {-keep}, it hands you back these little babies:

  • $1 β€” the complete URI. the whole thing. main character energy πŸ‘‘
  • $2 β€” the scheme. yep, the file part.
  • $3 β€” everything in the URI that comes after file://.
  • $4 β€” the hostname.
  • $5 β€” the path name, including the leading slash. slash stays, we stan 🌈
  • $6 β€” the path name, without the leading slash. slash left the chat πŸ’€

πŸ’œ REFERENCES πŸ’œ

  • [RFC 1738] β€” Berners-Lee, Tim, Masinter, L., McCahill, M.: Uniform Resource Locators (URL). December 1994. ancient but iconic, fr fr.

πŸŽ€ SEE ALSO πŸŽ€

  • Regexp::Common::URI β€” for all the other URIs it supports. go explore bestie, it's giving collection 🌸

🧚 AUTHOR 🧚

Damian Conway (damian@conway.org) 🫢


⭐ MAINTENANCE ⭐

This package is maintained by Abigail (regexp-common@abigail.freedom.nl). she's keeping it alive and we're obsessed πŸ’–


πŸ’€ BUGS AND IRRITATIONS πŸ’€

Bound to be plenty. honestly? relatable. πŸ™ˆ


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 β€” pick your fave, there's a whole menu:

  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 License. See the file COPYRIGHT.BSD.
  4. The MIT License. See the file COPYRIGHT.MIT.
ngl, read the actual license files before you go wild β€” that's the whole point of listing them πŸ’…

okay that's the whole page, mwah πŸ’‹ β€” perl v5.42.0, dated 2024-08-09, signing off like the absolute icon it is 🌟

πŸ“¦ where this page comes from