HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)

154 Chapter4
Advanced Forms Design
PATTERN MATCH
pattern.
MATCH !a:f Since the letter a is a pattern character, it is preceded by
an exclamation point. Other such characters within the
range are implicitly preceded by this operator. Thus, the
range is equivalent to specifying MATCH !a,!b,c,!d,e,f.
It is important to differentiate between a pattern range which is a range of single
characters, and the range check described earlier. In a pattern check, MATCH 10:90 means
the value must be a 1 followed by a digit between 0 and 9, followed a 0. In a range check,
IN 10:90 means the value must be in the range 10 through 90.
Grouping and Optional
You can group pattern specifications by enclosing the pattern in braces {}. Brackets [] make
the enclosed pattern optional. Braces indicate data must correspond to at least one item in
the group; brackets indicate any item in the group is optional. For example:
MATCH {A,AB,BCD}) ddd One of the choices within braces must be matched. For
example: A123 or AB999 or BCD562, among others, are
acceptable matches for this pattern.
MATCH [A,AB,BCD] ddd All choices within brackets can be omitted, or one may be
matched. For example: AB345, BCD567, A441, or 123 are
all acceptable matches.
MATCH [u,d]!+ [1:5] Some acceptable values are A+ or 5+3 or +5 or simply +.
MATCH [B,dd]dd[%,d] Accepts such values as B12 or 12345 or 50% or 10, among
others.
Since blanks may be included within braces, you can put blanks in a pattern to enhance its
clarity by enclosing the entire pattern within braces. For example,
MATCH {[B,dd] dd[%,d]} Identical to preceding pattern except that it is enclosed
within braces so that blanks can be included.
Enclosing a pattern within braces also allows the pattern to span lines. For example:
MATCH {[B,dd]
dd
[%,d]} Identical to the example above, except that each pattern
component is listed on a separate line.
Repetition
Repetition of any character or sets of characters can be indicated by an asterisk (*) or by a
plus sign (+) following any pattern character or pattern group within braces. Plus (+)
means that at least one occurrence of the pattern is required for the match; the asterisk (*)
means that zero or more occurrences can be matched. These repetition indicators cannot
follow items enclosed within brackets. Some examples:
MATCH d+ The plus sign indicates repetition of the digit, with at least
one occurrence required for the match. Leaving the field
blank is not acceptable unless the field type is 0 for