HP (Hewlett-Packard) HP OpenView Vantagepoint – Operation Manual for UNIX Printer User Manual


 
Syntax Used in VPO Configuration Files
Pattern Matching
Appendix A296
Pattern Matching
It is important to understand how VPO pattern matching works,
especially in conjunction with assignment to parameters.
When matching the pattern:
<*.var1><*.var2>
with the string abcdef, it is not immediately clear which substring of the
input string will be assigned to each variable. For example, it is possible
to assign an empty string to var1 and the whole input string to var2,or
to assign “a” to var1 and “bcdef” to var2, and so on.
The VPO pattern-matching algorithm always scans both the input line
and the pattern definition, including alternative expressions, from left to
right.
<*> expressions are assigned as few characters as possible.
<#>, <@> and <_> expressions are assigned as many characters as
possible.
Consequently, var1 is assigned an empty string in the above example.
To match an input string such as:
this is error 100: big bug
use a pattern such as: error<#.errnumber>:<*.errtext>
error<#.errnumber>:<*.errtext>
The result of this match is that 100 is assigned to errnumber, and big
bug is assigned to errtext.
For performance and pattern readability purposes, you can specify a
delimiting substring between two expressions. In the above example, :
is used to delimit <#> and <*>.
Matching <@.word><#.num> with “abc123” assigns “abc12” to word
and “3”tonum, because digits are permitted for both <#> and <@>, and
the left expression takes as many characters as possible.