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 π
π 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.
like, pick your fighter bestie, all four are valid πβ¨
π little sign-off moment: this page came fromperl v5.42.0, dated2024-08-09, and it lives atRegexp:...tespace(3)in the manual. drink water, close your file handles, and remember tos/$RE{ws}{crop}//gresponsibly π π§ββοΈ
π¦ 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