[hobbit] Some PCRE assistance

Charles Goyard cgoyard at cvf.fr
Tue Jan 16 12:05:00 CET 2007


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 :).


-- 
Charles Goyard - cgoyard at cvf.fr - (+33) 1 45 38 01 31



More information about the Xymon mailing list