Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything3pm
Always use the "/s" modifier with regular expressions.
Affiliation
This Policy is part of the core Perl::Critic distribution.
Overview
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 okmy $match = m< foo.bar >xms; # ok
Configuration
This Policy is not configurable except for the standard options.
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.
Releases
9 releases since Debian 6.0 (Squeeze); the text changed 8 times.