in reply to Excluding Words in RegEx
I would like to skip the line if it contains a word “group”. This word can occur anywhere in that line. How do I achieve in a single regex?
This is so simple, I think there must be more than your simple requirement.use Modern::Perl; while (<DATA>){ print $_ unless /\bgroup\b/; } __DATA__ This line is OK This line should be skipped: 'group' Drop this group too But keep this grouped content
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Excluding Words in RegEx
by Marshall (Canon) on Nov 06, 2011 at 11:28 UTC | |
by CountZero (Bishop) on Nov 06, 2011 at 16:31 UTC | |
|
Re^2: Excluding Words in RegEx
by Lotus1 (Vicar) on Nov 06, 2011 at 16:11 UTC | |
by CountZero (Bishop) on Nov 06, 2011 at 16:29 UTC | |
by dominic01 (Sexton) on Nov 07, 2011 at 04:08 UTC |