TASdvlper has asked for the wisdom of the Perl Monks concerning the following question:
I have another regexp question (seems to be my favorite topic).
I'm trying to parse the output of a cli command, and I'm looking for string, in each output line, that consists of digits seperated by periods. i.e.
but, my problem is, I don't want to capture the output if the 3 field, from the left, is a 0,1,2, or 3. But, it can start with it. I have this snippet:0.1.4.1 0.1.5.2 0.1.6.3 0.1.7.4
But this will not work if the 3rd field is a double digit.if ( /.*(\d+\.\d+\.[4-9]\.\d+).*/ ) { print "$1 <br> \n"; }
So, to elaborate more, the following I want to ignore:
but, these I do want to capture:0.1.1.1 0.1.2.2 0.1.3.3
Basically, if the 3rd field is > 3, I want to capture it.0.1.10.1 0.1.20.2 0.1.30.3
Any thoughts on to do this ???? Thx.
20040519 Edit by Corion: Changed title from 'Another regular expression'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about conditional regex capture
by Fletch (Bishop) on May 18, 2004 at 20:02 UTC | |
|
Re: Question about conditional regex capture
by kvale (Monsignor) on May 18, 2004 at 20:03 UTC | |
|
Re: Question about conditional regex capture
by cLive ;-) (Prior) on May 18, 2004 at 20:16 UTC | |
|
Re: Question about conditional regex capture
by saskaqueer (Friar) on May 18, 2004 at 20:16 UTC | |
|
Re: Question about conditional regex capture
by Abigail-II (Bishop) on May 19, 2004 at 08:57 UTC | |
|
Re: Question about conditional regex capture
by hv (Prior) on May 19, 2004 at 13:03 UTC |