[hobbit] PCRE reference with examples
No \s is typically used to indicate whitespace in regexp's. \w usually matches alphanumeric characters and the underscore character, hence Rich probably wants something like:
HOST=%^va\w*
% - required by Hobbit to indicate the start of a regexp ^ - start of line character \w - matches any alphanumeric/underscore character
- 0 or more \w's
You can add a $ to the end of the line, but it won't change anything since the * will grab all the characters to the end of the line anyway, assuming that they are all alphanumeric and that Hobbit strips off all the leading and trailing whitespace.
Thanks, Larry Barber
On Thu, 2005-10-13 at 11:02 -0500, henrik at hswn.dk wrote:
On Thu, Oct 13, 2005 at 10:50:26AM -0500, Rich Smrcina 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.I'd say HOST=%^va[\d]*$
You need the "%" first, to tell Hobbit that what comes next is a regexp. Then the "^" means that the expression must match at the beginning of the string. "\w" is whitespace ? Think so - in that case it is not needed, since Hobbit will never match with any whitepace in the hostname.
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
What comes after the MAIL keyword is passed directly to your "mail" utility. So it would probably be better to have
$pg-tom=tomsemail at somewhere.com,tomscell at wireless.com
if your "mail" tool supports listing multiple recipients separated by commas. Some dont - then you can use a short-hand notation like:
$pg-tom=tomsemail at somewhere.com tomscell at wireless.com
and separate them by spaces - Hobbit will handle this as if you had multiple "MAIL ..." lines with each of the mail recipients. So it sends out the mail in separate e-mails, instead of one e-mail to all of the recipients. (Same net effect).
One more thing: I'm sure "DURATION=5m" is not what you want. Make that "DURATION>5m".
Regards, Henrik
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
participants (1)
-
Larry.Barber@usda.gov