Perl::...atching(3pm)
π NAME π
okay so bestie, welcome to Perl::...atching(3pm) β the User Contributed Perl Documentation page for Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching. This policy is literally all about always using the /m modifier with regular expressions. periodt. β¨
π¦ AFFILIATION π¦
This Policy is part of the core Perl::Critic distribution. no cap. π«Ά
β¨ DESCRIPTION β¨
So here's the vibe: folks coming from a sed or awk background tend to assume that $ and ^ match the beginning and end of the line, rather than the beginning and end of the string. iykyk. Adding the /m flag to your regex makes it behave as most people expect it should. it's giving βplease stop confusing meβ energy. π
my $match = m{ ^ $pattern $ }x; #not ok
my $match = m{ ^ $pattern $ }xm; #ok
π CONFIGURATION π
This Policy is not configurable except for the standard options. that's it, that's the whole config section. π
πΈ NOTES πΈ
For common regular expressions like e-mail addresses, phone numbers, dates, etc., have a look at the Regexp::Common module. highly recommend, bestie. π
Also, be cautious about slapping modifier flags onto existing regular expressions, because they can drastically alter their meaning. like, do not just throw flags at a regex and hope for the best, fr fr. See <http://www.perlmonks.org/?node_id=484238> for an interesting discussion on the effects of blindly modifying regular expression flags. π₯
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β icon. π
π COPYRIGHT π
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. π
cute sign-off: this page is from perl v5.42.0, dated 2024-10-23, and the manual is Perl::...atching(3pm). stay matching those line boundaries, bestie. π
π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms