Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

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.2 2012Perl::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.3 2014-06-09Perl::Critic::Policy::RegularExpressions::RequireDotMatchAnything(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File/directory information......

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)
Discussion started by: Makaveli.2003
50 Replies

2. Shell Programming and Scripting

KSH Expression

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)
Discussion started by: tmarikle
4 Replies

3. Shell Programming and Scripting

sed question

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)
Discussion started by: Vikas Sood
17 Replies

4. Shell Programming and Scripting

Awk

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)
Discussion started by: DNAx86
22 Replies

5. Shell Programming and Scripting

Perl syntax for sed searches

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)
Discussion started by: masinick
11 Replies

6. Shell Programming and Scripting

How to extract text from string using regular expressions

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)
Discussion started by: jtung
9 Replies

7. UNIX for Dummies Questions & Answers

Removing a string of text from a file - help please

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)
Discussion started by: deepslp
5 Replies

8. Shell Programming and Scripting

using SED or perl with / pattern

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)
Discussion started by: anushree.a
4 Replies

9. UNIX for Dummies Questions & Answers

sed or awk - removing part of line?

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)
Discussion started by: alis
11 Replies

10. Shell Programming and Scripting

Perl: Sorting a hash value that is a list.

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)
Discussion started by: g_string
9 Replies

11. Shell Programming and Scripting

Using regular expressions to separate apples from oranges

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)
Discussion started by: odyssey
7 Replies

12. Shell Programming and Scripting

sed using wildcard

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)
Discussion started by: poova
6 Replies

13. Shell Programming and Scripting

Add new line at beginning and end of a file

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)
Discussion started by: bhupinder08
6 Replies

14. Shell Programming and Scripting

awk or sed or python for regular expressions ?

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)
Discussion started by: John K
5 Replies

15. UNIX for Beginners Questions & Answers

Remove space with sed

Hello Folks , myfile contains 1000000 records as follows: logver=56 idseq=63256 itime=1111 devid=TG-40 devname=PUI-C2 vd=USER date=2019_01_10 time=18:39:49 logid="000013" type="traffic" subtype="forward" level="notice" eventtime=134 srcip=1.1.1.1 srcport=1 srcintf="XYX-CORE.01"... (3 Replies)
Discussion started by: arm
3 Replies