Xymon Mailing List Archive search

PCRE reference with examples

list Dan Vande More
Thu, 13 Oct 2005 11:03:22 -0500
Message-Id: <user-fda961932430@xymon.invalid>

You'll probably be better off with:

HOST=^va.*$

(Note the caret instead of the dollar sign.)

-Dan

On 10/13/05, Rich Smrcina <user-cf452ff334e0@xymon.invalid> wrote:
Ok, that's great info.  Thanks!

Based on that I'm ending up with an expression like:

HOST=$va[\d\w]*$

To match any host beginning with 'va' that has zero or more alphanumeric
characters after it.  Is there an easier way to write this?  If not
that's fine, I just want to make sure I'm using it correctly.

Another poster (Asif Iqbal) posted the MAIL directives with multiple
recipients.  Does that work like he posted?  Can the multiple email
recipients be put into a macro?  Consider the following:

$pg-tom=(user-09601a56c098@xymon.invalid|user-caed2b630f14@xymon.invalid)
HOST=tomshost
        MAIL $pg-tom DURATION=5m COLOR=red

Henrik Stoerner wrote:
On Wed, Oct 12, 2005 at 10:14:14PM -0500, Rich Smrcina wrote:
Is there an online reference for PCRE available, including examples?
I'm having difficulty setting up alerts and I clearly need help with PCRE.

I did a google on "regular expression tutorial" and came up with this:

http://www.regular-expressions.info/tutorial.html

It isn't specific to PCRE, but PCRE implements the regex flavor found
in Perl, so it should get you going.

Also, for trying out your regexes there's the "pcretest" utility which
comes with the PCRE library. It lets you input your regex and try it out
against selected candidate strings:

henrik at osiris:~$ pcretest
PCRE version 4.5 01-December-2003

  re> /(www|mail|ns).foo.com/
  data> ns.foo.com
   0: ns.foo.com
    1: ns
    data> print.foo.com
    No match


Note that you must put the regex inside slashes when entering it
into pcretest (it supports multi-line regexes - Hobbit doesn't).


Henrik

--
Rich Smrcina
VM Assist, Inc.
Main: (262)392-2026
Cell: (XXX)XXX-XXXX
Ans Service:  (360)715-2467
user-61add9955ef9@xymon.invalid

Catch the WAVV!  http://www.wavv.org
WAVV 2006 - Chattanooga, TN - April 7-11, 2006