perl::critic::policy::regularexpressions::requirelineboundarymat(3pm) [debian man page]
Perl::Critic::Policy::RegularExpressions::RequireLineBouUseryContributedPerl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching(3pm)NAME
Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching - Always use the "/m" modifier with regular expressions.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Folks coming from a "sed" or "awk" background tend to assume that '$' and '^' match the beginning and end of the line, rather than then
beginning and end of the string. Adding the '/m' flag to your regex makes it behave as most people expect it should.
my $match = m{ ^ $pattern $ }x; #not ok
my $match = m{ ^ $pattern $ }xm; #ok
CONFIGURATION
This Policy is not configurable except for the standard options.
NOTES
For common regular expressions like e-mail addresses, phone numbers, dates, etc., have a look at the Regexp::Common module. Also, be
cautions 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.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
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.
perl v5.14.22012Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching(3pm)
Check Out this Related Man Page
Perl::Critic::Policy::RegularExpressions::RequireDotMatcUsertContributed Perl Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything(3)NAME
Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything - Always use the "/s" modifier with regular expressions.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
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 "[^
]". 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
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.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
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.
perl v5.16.32014-06-09Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything(3)
Basically i have done created the script below, and it functions ok, it prints the access rights the user has. But i need it to print the group permissions, and other permissions, it would also be helpful if i could print the permissions in numeric form aswell, if it is possible. I have looked in... (50 Replies)
Quick question related to KSH expressions (not unix regular expressions).
I am trying to craft a pattern that will correctly identify lines that match the following CSV text in a case statement:
filename.txt, filename.txt, alpha, nnnn, nnnn, nnnn, Free form text
Originally I simply used... (4 Replies)
Hi
I am trying to replace an extension in a file name using sed as follows:
echo $filename | sed 's/.txt/.doc/'
My objective is to replace any extension with let's say a .doc extension. Right now, my input may have two extensions; .txt and .csv. I have to replace both with a .doc... (17 Replies)
This part of script look of a pattern in a file ($file) and should print the file names of the file if the pattern is found between min and max.
I don't know very well AWK, so i written this script thinking that $0 is the current field, but maybe is the current record, not the field. That may be... (22 Replies)
I am aware that Perl has a lot of features that originally came from sed and awk. I have a pattern that I am using like this:
sed -n '/|Y|/p'
I want to do the same thing in Perl and be able to either save that value in some kind of variable or array or potentially write it out to a file.
... (11 Replies)
Hi,
I'm trying to use sed to extract some text and assign it to a variable.
Can anyone provide me with some help? it would be much appreciated!
I"m looking to extract for example:
filename=/output/R34/2005_13_R34_C1042S_T83_CRFTXT_20081015.txt
I'm trying to extract the 1042... (9 Replies)
Hey Folks,
I have a file that contains data that I am working with, sometimes this file has a very long string of text that messes with an awk command in a script i am trying to build. I would like to cut this string of text out of a file and then redirect everything except that string to a new... (5 Replies)
Dear Friends,
I have a flat file which has dates with / as separator.
I want to remove these dates by using perl or sed but due to / as separator I am unable to use perl or sed.
Please guide me to do the same
Thank you in advance.
Anushree. (4 Replies)
hi all,
I am having trouble finding the right string for this - I dont know whether to use awk or sed..
If I have a file with alot of names and phone numbers like this
McGowan,Sean 978-934-4000
Kilcoyne,Kathleen 603-555-1212
Club603,The 617-505-1332
Boyle,William 301-444-1221
And... (11 Replies)
Hi Folks
I am very much a newbie at perl but picking it up and I'm hoping you can help.
I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>"
I want to parse this data display it as the following:... (9 Replies)
I have a problem that I think could (should?) be possible using regular expressions. I've been using regular expressions for some time, so I have some experience with it, but I can't find a way to make this work correctly.
Say I have a long string of different fruits:
and I need the first... (7 Replies)
Hi Folks,
I had a requirement to replace a pattern a.*a with 'a' alone. I'm writing a sed command to do that. But I'm not able to work this out. Pls help me.
echo 'a123a456a789' | sed 's/a.*a/a/'
Expected o/p : a456a789
But actual o/p is a789. :confused:
how can write that... (6 Replies)
Hi,
I have a specific requirement to add text at the beginning and end of a plain text file. I tried to use "sed" with '1i' and '$a' flags but these required two separate "sed" commands separated with "|".
I am looking for some command/option to join these two in single command parameter.
... (6 Replies)
Linux 6.X environments (RHEL, Oracle Linux )
I could write basic shell scripts in bash.
In my spare time, I was planning to learn awk or sed to deal with regular expression tasks I have to deal with. But, I gather that python is gaining popularity these days and I came to know that python has a... (5 Replies)