I'm struggling with a regex requirement on our Xymon monitoring system
which uses Perl format regular expression.
I have the following data,
red Queue TEST1:DI.CATALOGUE.ITEM.IMPORT.BO has depth 10 (critical: 10,
warn: 1)
red Queue TEST1:DI.PRODUCT.HIERARCHY.IMPORT.BO has depth 20 (critical:
10, warn: 1)
yellow Queue TEST1:DI.CATSETUP.PRODUCT.IMPORT.BO has depth 9 (warn: 1,
critical: 10)
green Queue TEST1:ATP.CANCEL.PARCEL.CONFIRM.EXPORT.BO has depth 0
(warn: 1, critical: 10)
green Queue TEST1:ATP.CANCEL.PARCEL.CONFIRM.EXPORT.LQ has depth 0
(warn: 30, critical: -1)
green Queue TEST1:ATP.DELIVERY.DEFINITION.EXPORT.BO has depth 0 (warn:
1, critical: 10)
green Queue TEST1:ATP.DELIVERY.DEFINITION.EXPORT.LQ has depth 0 (warn:
10, critical: -1)
green Queue TEST1:ATP.FOREIGN.PARCEL.EXPORT.BO has depth 0 (warn: 1,
critical: 10)
green Queue TEST1:ATP.FOREIGN.PARCEL.EXPORT.LQ has depth 0 (warn: 5,
critical: -1)
green Queue TEST1:ATP.PARCEL.DESPATCH.EXPORT.BO has depth 0 (warn: 1,
critical: 10)
In most situations I need to match all lines containing a string ending
".BO" which I do like this,
([A-Z.]*BO)<br>
however for this particular requirement I need to match the same but
exclude the 2 lines below
DI.PRODUCT.HIERARCHY.IMPORT.BO
DI.CATSETUP.PRODUCT.IMPORT.BO
This is where my knowledge of regular expression lets me down as I
can't seem to find a way to match all ".BO" except these 2.
It would appear I missed a couple of things.
1. I will probably only ever need to exclude this 2 lines
2. It needs to be a single statement (a peculiarity of Xymon monitoring)
3. The exclusions ideally need to be the whole string but could at a push be restricted to the words HEIRARCHY and CATSETUP
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.