Regexp:...tespace(3)

πŸ¦‹ Regexp::Common::whitespace β€” the crop-y whitespace regex πŸ’…

okay bestie so this is a page from the User Contributed Perl Documentation manual, section 3, and it's literally about Regexp::Common::whitespace β€” yes the name in the header is truncated to Regexp:...tespace(3), that's just how the man page shows it, don't come for me πŸ™ˆ


✨ NAME ✨

Regexp::Common::whitespace β€” provides a regex for leading or trailing whitescape πŸŽ€

ngl the original says "whitescape" and I'm keeping it exactly as-is, character for character, because that's the vibe and also because we do not edit the source. πŸ’€

🌸 SYNOPSIS 🌸

use Regexp::Common qw /whitespace/;

while (<>) {
    s/$RE{ws}{crop}//g;           # Delete surrounding whitespace
}

like, that's it. that's the whole thing. she's simple, she's iconic πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

Please consult the manual of Regexp::Common for a general description of the works of this interface. 🫢

Do not use this module directly, but load it via Regexp::Common. β€” fr fr, do NOT come for this module directly, that's not the move, load it through Regexp::Common like a civilized human ✨

🧚 "$RE{ws}{crop}"

Returns a pattern that identifies leading or trailing whitespace. periodt.

For example:

$str =~ s/$RE{ws}{crop}//g;     # Delete surrounding whitespace

The call:

$RE{ws}{crop}->subs($str);

is optimized (but probably still slower than doing the s///g explicitly). 😭 like she tried her best, she's optimized, but hand-rolling the s///g yourself will probably still beat her. no cap.

This pattern does not capture under "-keep". πŸš«πŸ“Έ


πŸ‘€ SEE ALSO πŸ‘€

Regexp::Common for a general description of how to use this interface. πŸ¦‹


πŸ’œ AUTHOR πŸ’œ

Damian Conway (damian@conway.org) β€” icon, legend, the moment 🌟


πŸŽ€ MAINTENANCE πŸŽ€

This package is maintained by Abigail (regexp-common@abigail.freedom.nl). 🫑


πŸ’€ BUGS AND IRRITATIONS πŸ’€

Bound to be plenty. πŸ’€πŸ’€πŸ’€

For a start, there are many common regexes missing. Send them in to regexp-common@abigail.freedom.nl. πŸ“¬ like genuinely, they're asking, send the regexes, be the main character 🌈


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:

  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.

like, pick your fighter bestie, all four are valid πŸŽ€βœ¨


πŸ“ little sign-off moment: this page came from perl v5.42.0, dated 2024-08-09, and it lives at Regexp:...tespace(3) in the manual. drink water, close your file handles, and remember to s/$RE{ws}{crop}//g responsibly πŸ’…πŸ§šβ€β™€οΈ
πŸ“¦ where this page comes from