[hobbit] PCRE reference with examples

Henrik Stoerner henrik at hswn.dk
Thu Oct 13 07:49:33 CEST 2005


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




More information about the Xymon mailing list