Xymon Mailing List Archive search

Some PCRE assistance

6 messages in this thread

list Rich Smrcina · Mon, 15 Jan 2007 12:49:03 -0600 ·
I've checked the PCRE tutorial and several other sites and I can not find a good match to what I'm trying to do.  I've also run several iterations through pcretest with no joy.

I have a list of users (actually virtual machine names) with the heading 'UserID'.  I would like to set up a regex to match any of them, except for the heading.  Basically, to count the machines, but ignore the heading line.

I've tried variations of "(!Userid|.*)" with no luck.

Thanks.
-- 
Rich Smrcina
VM Assist, Inc.
Phone: XXX-XXX-XXXX
Ans Service:  XXX-XXX-XXXX
user-61add9955ef9@xymon.invalid

Catch the WAVV!  http://www.wavv.org
WAVV 2007 - Green Bay, WI - May 18-22, 2007
list Galen Johnson · Mon, 15 Jan 2007 17:20:23 -0500 ·
quoted from Rich Smrcina
Rich Smrcina wrote:
I've checked the PCRE tutorial and several other sites and I can not find a good match to what I'm trying to do.  I've also run several iterations through pcretest with no joy.

I have a list of users (actually virtual machine names) with the heading 'UserID'.  I would like to set up a regex to match any of them, except for the heading.  Basically, to count the machines, but ignore the heading line.

I've tried variations of "(!Userid|.*)" with no luck.

Thanks.
Is this within a script or a hobbit config file?

=G=
list Rich Smrcina · Mon, 15 Jan 2007 20:52:39 -0600 ·
hobbit-clients.cfg

Galen Johnson wrote:
Rich Smrcina wrote:
I've checked the PCRE tutorial and several other sites and I can not find a good match to what I'm trying to do.  I've also run several iterations through pcretest with no joy.

I have a list of users (actually virtual machine names) with the heading 'UserID'.  I would like to set up a regex to match any of them, except for the heading.  Basically, to count the machines, but ignore the heading line.

I've tried variations of "(!Userid|.*)" with no luck.

Thanks.
Is this within a script or a hobbit config file?

=G=

-- 
Rich Smrcina
VM Assist, Inc.
Phone: XXX-XXX-XXXX
Ans Service:  XXX-XXX-XXXX
user-61add9955ef9@xymon.invalid

Catch the WAVV!  http://www.wavv.org
WAVV 2007 - Green Bay, WI - May 18-22, 2007
list Craig Cook · Mon, 15 Jan 2007 23:38:26 -0500 ·
Can you post 3-4 lines of sample data (including your header line)?

I suspect the .* is being greedy.

Craig Cook
--
Systems Monitoring Consulting and Support Services
http://www.cookitservices.com
list Charles Goyard · Tue, 16 Jan 2007 12:05:00 +0100 ·
Hi,
quoted from Rich Smrcina

Rich Smrcina wrote :
I've checked the PCRE tutorial and several other sites and I can not find a good match to what I'm trying to do.  I've also run several iterations through pcretest with no joy.

I have a list of users (actually virtual machine names) with the heading 'UserID'.  I would like to set up a regex to match any of them, except for the heading.  Basically, to count the machines, but ignore the heading line.

I've tried variations of "(!Userid|.*)" with no luck.
I guess you want to do it something like the procs column.

If the format is :

Userid
john
jane

you might want to try that :

^(?!Userid)(.+)

(Search the string "look-ahead assertion" in perlre(1) for some
explanation of this. Don't forget to add the preceding % in your
configfile.

It basically permits one to make pattern match only if they are not
preceded or followed by certain expressions. (Very useful when
piggy-parsing HTML :).


-- 
Charles Goyard - user-98f9625a7a59@xymon.invalid - (+33) 1 45 38 01 31
list Rich Smrcina · Tue, 16 Jan 2007 05:18:45 -0600 ·
Yes, that is the format of the list.

I actually solved the problem another way, I always thought the heading line was superfluous in this case anyway.

This is for a procs test for the z/VM client that I'm writing.  In this case a dispatchable unit of work is a virtual machine, so the 'process' list contain the names of the virtual machines.  Well since it is just a list of names and not process numbers, CPU Time, command, etc, I just changed the back-end client code to not require the heading line coming from the client.

Thanks to all who responded.
quoted from Charles Goyard

Charles Goyard wrote:
Hi,

Rich Smrcina wrote :
I've checked the PCRE tutorial and several other sites and I can not find a good match to what I'm trying to do.  I've also run several iterations through pcretest with no joy.

I have a list of users (actually virtual machine names) with the heading 'UserID'.  I would like to set up a regex to match any of them, except for the heading.  Basically, to count the machines, but ignore the heading line.

I've tried variations of "(!Userid|.*)" with no luck.
I guess you want to do it something like the procs column.

If the format is :

Userid
john
jane

you might want to try that :

^(?!Userid)(.+)

(Search the string "look-ahead assertion" in perlre(1) for some
explanation of this. Don't forget to add the preceding % in your
configfile.

It basically permits one to make pattern match only if they are not
preceded or followed by certain expressions. (Very useful when
piggy-parsing HTML :).

-- 
Rich Smrcina
VM Assist, Inc.
Phone: XXX-XXX-XXXX
Ans Service:  XXX-XXX-XXXX
user-61add9955ef9@xymon.invalid

Catch the WAVV!  http://www.wavv.org
WAVV 2007 - Green Bay, WI - May 18-22, 2007