logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything - Always use the "/s" modifier with

Affiliation

       This Policy is part of the core Perl::Critic distribution.

Author

       Jeffrey Ryan Thalhammer  <jeff@imaginative-software.com>

Configuration

       This Policy is not configurable except for the standard options.

Description

       When asked what "." in a regular expression means, most people will say that it matches any character,
       which isn't true.  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

Name

       Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything - Always use the "/s" modifier with
       regular expressions.

Notes

       Be cautious about slapping modifier flags onto existing regular expressions, as they can drastically
       alter their meaning.  See <http://www.perlmonks.org/?node_id=484238> for an interesting discussion on the
       effects of blindly modifying regular expression flags.

See Also