[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] PCRE reference with examples



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=(tomsemail (at) somewhere.com|tomscell (at) wireless.com)
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


To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe (at) hswn.dk




-- Rich Smrcina VM Assist, Inc. Main: (262)392-2026 Cell: (414)491-6001 Ans Service: (360)715-2467 rich.smrcina at vmassist.com

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