[hobbit] PCRE Assistance

Odinn odinn_asgaard at yahoo.com
Fri Mar 26 21:45:52 CET 2010


Careful not to confuse globbing with regex

%(bbdisplay|xymon|katahdin|^netmon-.*).umdnj.edu
 
You were almost there.  * means to match the previous character 0 or more times

. is any character, so .* is match any character 0 or more times.

.+ would be to match any character 1 or more times

This is different than globbing, where * means any character 0 or more times.

Common mistake for those not familiar with the intricacies or regex vs globbing.
--


Jim Sloan


Just remember, today is the day you thought tomorrow was going to be yesterday.



----- Original Message ----
From: Ryan Novosielski <novosirj at umdnj.edu>
To: hobbit at hswn.dk
Sent: Fri, March 26, 2010 4:17:48 PM
Subject: [hobbit] PCRE Assistance

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm feeling rather dopey at not being able to figure this out, but bear
with me.

I'm trying to define a regex that will match, among other things, a line
that begins with: netmon- and any number of characters that follow it,
and then ends with my domain name. The two I need it to match right now
are: "netmon-int.umdnj.edu" and "netmon-ext.umdnj.edu" but there may be
others going forward.

Here is my example:

%(bbdisplay|xymon|katahdin|^netmon-*).umdnj.edu

I was suspicious of the ^, so I tried removing it -- no change. So far
I've tried this list of things:

%(bbdisplay|xymon|katahdin|netmon-*).umdnj.edu
%(bbdisplay|xymon|katahdin|^netmon\-*).umdnj.edu
%(bbdisplay|xymon|katahdin|netmon\-*).umdnj.edu

...maybe one or two others. When I try either of the two hostnames I'm
trying to match with pcretest, I get "No match". Can anyone point me in
the right direction? It's surely something simple.

- --
---- _  _ _  _ ___  _  _  _
|Y#| |  | |\/| |  \ |\ |  | |Ryan Novosielski - Systems Programmer II
|$&| |__| |  | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922)
\__/ Univ. of Med. and Dent.|IST/CST - NJMS Medical Science Bldg - C630
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkutFmsACgkQmb+gadEcsb5ljQCfeHH215LC1dLo3guwlJkPzp4H
6MIAnRILcRuLfvoAsNY5/5uBLNM+QkEH
=eMzo
-----END PGP SIGNATURE-----

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



      



More information about the Xymon mailing list