Perl::...nything(3pm)

okay so bestie, welcome to the Perl::...nything(3pm) page from the User Contributed Perl Documentation πŸ’– we are diving in, and yes it’s giving very specific regex energy ✨

🌸 NAME 🌸

Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything β€” always use the /s modifier with regular expressions. periodt πŸ’…

πŸ¦‹ AFFILIATION πŸ¦‹

This Policy is part of the core Perl::Critic distribution. iconic, honestly πŸ‘‘

πŸŽ€ DESCRIPTION πŸŽ€

okay so when someone asks what . means in a regular expression, most people will say it matches any character β€” and that is not true, bestie 😭 it’s actually shorthand for [^\n]. using the s modifier makes . act like people expect it to πŸ’«

my $match = m< foo.bar >xm;  # not ok
my $match = m< foo.bar >xms; # ok

see? the s is doing the lord’s work πŸ™

✨ CONFIGURATION ✨

This Policy is not configurable except for the standard options. that’s it, that’s the config section πŸŽ€

πŸ’œ NOTES πŸ’œ

be cautious about slapping modifier flags onto existing regular expressions, because they can drastically alter their meaning 😳 seriously, do not just vibe-check your way through regex flags. 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> πŸ’Œ

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. slay, legal bestie πŸ’…


and that’s the whole page, bestie 🫢 the footer says perl v5.42.0, dated 2024-10-23, and this manual is Perl::...nything(3pm). mwah πŸ’‹

πŸ“¦ where this page comes from