> The page I monitor returns
 
> Status Code(s) = 6

> My current Expect  looks like this    = ~6
 
> However, in WUP it fails�..   Any ideas?
 
The "~" in the Expect that you quote is WhatsUp Gold syntax.  The statement 
means "expect a string that contains "6"".

There is no "~" in WhatsUp Professional.  Every expression is a "contains" 
expression unless specified otherwise by the use of Metacharacters that specify 
position.

WhatsUp Gold already supported one such Metacharacter.  "^", matching the 
position at the start of the input.  WhatsUp Professional adds "$", allowing 
you to match against the end of the input.

There's much more... WhatsUp Professional uses a new Regular Expression engine. 
I attach a a document that I have just composed.  Regard it as a replacement 
for the current Help (well, except for the strange table cell borders).

Back to the failure to match.

The expression you are using is very basic.  In fact,  I would expect it to 
give false positives.  For instance, a match against a tag such as <H6>.

All other things being equal, this expression should work:

Expect=Status Code\(s\) = 6

It could still fail.  Are there HTML snippets such as "&nbsp" that are in the 
string, but not visible when viewing the web page in a browser?  Because if 
there is anything extra in the string it has to be accounted for. A "View 
Source" in your browser will show you what's really going on under the hood.


Mark Symons
Ipswitch, Inc
Augusta GA
Title: Regex Help

Regular _expression_ Syntax


This table lists the metacharacters understood by the WhatsUp Professional Regex Engine.


Matching a Single Character

Metacharacter

Matches

 .
dot
Matches any one character
 [...]
character class Matches any character inside the brackets.
Example, [abc] matches "a", "b", and "c"
 [^...]
negated character class
Matches any character except those inside the brackets.
Example, [^abc] matches all characters except "a", "b", and "c".
See below for alternate use - the way ^ is used controls its meaning.
 -
dash
Used within a character class. Indicates a range of characters.
Example: [2-7] matches any of the digits "2" through "9".
Example: [0-3a-d] is equivalent to [0123abcd]
 \char
escaped character
Interpret the next character literally. 
Example: 3\.14 matches only "3.14". whereas 3.14 matches 3234, etc.
 /xnn
binary character
Match a single binary character. nn is a hexadecimal value between 00 and FF.
Example:  /41 matches "A"
Example: /0B matches Vertical Tab
Quantifiers
 ?
question
One optional. the preceding _expression_ once or not at all.
Example: colou?r matches "colour" or "color"
Example: [0-3][0-5]? matches "2" and "25"
 *
star
Any number allowed, but are optional.
Example:  .*  Zero or more occurences of any character
 + plus
One required, additional are optional.
Example, [0-9]+ matches "1", "15", "220", and so on
 ??, +?, *?

"Non-greedy" versions of ?, +, and *. Match as little as possible, whereas the "greedy" versions match as much as possible
Example: Fot input string <html>content</html>
<.*?> matches <html>
<.*> matches <html>content</html>
Matching Position
 ^
caret
Matches the position at the start of the input.
Example: ^2 will only match input that begins with "2".
Example: ^[45] will only match imput that begins with "4" or "5"
 $
dollar
At the end of a regular _expression_, this character matches the end of the input.
Example: >$ matches a ">" at the end of the input.
Other
 |
alternation
Matches either _expression_ it separates.
Example:  H|Cat matches either "Hat" or "Cat"
 (...)
parentheses
Provides grouping for quantifiers, limits scope of alternation via precedence.
Example: (abc)*  matches 0 or more occurrences of the the string abc
Example: WhatsUp (Gold)|(Professional) matches "WhatsUp Gold" or "WhatsUp Professional"
 \0, \1, ...
backreference
Matches text previously matched within first, second, etc, match group (starting at 0).
Example: <{head}>.*?</\0> matches "<head>xxx</head>".

Abbreviations

Abbreviations are shorthand Metacharacters

Abbreviation Matches
\a Any alphanumeric character: ([a-zA-Z0-9])
\b White space (blank): ([ \\t])
\c Any alphabetic character: ([a-zA-Z])
\d Any decimal digit: ([0-9])
\D
Any non decimal digit ([^0-9])
\h Any hexadecimal digit: ([0-9a-fA-F])
\n Newline: (\r|(\r?\n))
\p
Any punctuation character
\P
Any non-punctuation character
\q A quoted string: (\"[^\"]*\")|(\'[^\']*\')
\s
WhatsUp Gold style white space character [ \\t\\n\\r\\f\\v]
\S
WhatsUp Gold style non-white space character [^ \\t\\n\\r\\f\\v]
\w Part-of-word character ([a-zA-Z0-9_])
\W
Non-word character ([^a-zA-Z0-9_])
\z An integer: ([0-9]+)


Related Topics

Script Syntax: Expect=Keyword

Reply via email to