PMDF System Manager's Guide


Previous Contents Index

5.3.1 Mapping Entry Patterns

Patterns can contain wildcard characters. In particular, the usual OpenVMS wildcard characters are allowed: an asterisk, *, will match zero or more characters and each percent sign, %, will match a single character. Asterisks, percent signs, spaces, and tabs can be quoted by preceeding them with a dollar sign, $. Quoting an asterisk or percent sign robs it of any special meaning. Spaces and tabs must be quoted to prevent them from ending prematurely a pattern or template. Literal dollar sign characters should be doubled, $$, the first dollar sign quoting the second one. Additional wildcards available in patterns are listed in Table 5-1.

Table 5-1 Mapping Pattern Wildcards
Wildcard Description
% Match exactly one character
* Match zero or more characters, with maximal or "greedy" left-to-right matching
Back match Description
$ n* Match the nth wildcard or glob
Modifiers Description
$_ Use minimal or "lazy" left-to-right matching
$@ Turn off "saving" of the succeeding wildcard or glob
$^ Turn on "saving" of the succeeding wildcard or glob; this is the default
Glob  
wildcard Description
$A% Match one alphabetic character, A--Z or a--z
$A* Match zero or more alphabetic characters, A--Z or a--z
$B% Match one binary digit (0 or 1)
$B* Match zero or more binary digits (0 or 1)
$D% Match one decimal digit 0--9
$D* Match zero or more decimal digits 0--9
$H% Match one hexadecimal digit 0--9 or A--F
$H* Match zero or more hexadecimal digits 0--9 or A--F
$O% Match one octal digit 0--7
$O* Match zero or more octal digits 0--7
$S% Match one symbol set character, i.e., 0--9, A--Z, a--z, _, $
$S* Match zero or more symbol set characters, i.e., 0--9, A--Z, a--z, _, $
$T% Match one tab or vertical tab or space character
$T* Match zero or more tab or vertical tab or space characters
$X% A synonym for $H%
$X* A synonym for $H*
$[ c]% Match character c
$[ c]* Match arbitrary occurrences of character c
$[ c 1 c 2 ... c n ]% Match exactly one occurrence of character c 1 , c 2 , or c n
$[ c 1 c 2 ... c n ]* Match arbitrary occurrences of any characters c 1 , c 2 , or c n
$[ c 1 -c n ]% Match any one character in the range c 1 to c n
$[ c 1 -c n ]* Match arbitrary occurrences of characters in the range c 1 to c n
$< IPv4> Match an IPv4 address, ignoring bits
$( IPv4) Match an IPv4 address, keeping prefix bits
${ IPv6} Match an IPv6 address

Note that to specify multiple modifiers, or to specify modifiers and a back match, the syntax uses just one dollar character. For instance, to back match the initial wild card, without saving the back match itself, one would use $@0, not $@$0.

Note that the PMDF TEST/MATCH (OpenVMS) or pmdf test -match (UNIX) utility can be used to test mapping patterns and specifically to test wildcard behavior in patterns.

5.3.1.1 The $_ modifier: minimal vs. maximal Matching

Asterisk, *, wildcards maximize what they match working from left to right across the pattern. For instance, when the string a/b/c is compared to the pattern */*, the left asterisk will match a/b and the right asterisk will match c.

The $_ modifier causes wildcard matching to be minimized, where the least possible match is considered the match, working from left to right across the pattern. For instance, when the string a/b/c is compared to the pattern $_*/$_*, the left $_* will match a and the right $_* will match b/c.

5.3.1.2 IP Matching

With IPv4 "prefix bits" matching, an IP address or subnet is specified, optionally followed by a slash and the number of bits from the prefix that are significant when comparing for a match. For instance,


$(123.45.67.0/24) 
will match anything in the 123.45.67.0 subnet.

With IPv4 "ignore bits" matching, an IP address or subnet is specified, optionally followed by a slash and the number of bits to ignore when checking for a match. For instance,


$<123.45.67.0/8> 
will match anything in the 123.45.67.0 subnet. Or another example is that


$<123.45.67.4/2> 
will match anything in the range 123.45.67.4--123.45.67.7.

IPv6 matching matches an IPv6 address or subnet.

5.3.1.3 Character Matching

Within globs, i.e., within a $[...] construct, the backslash character, (\), is the quote character. To represent a literal hyphen, -, or right bracket, ], within a glob the hyphen or right bracket must be quoted with a backslash.

All other characters in a pattern just represent and match themselves. In particular, single and double quote characters as well as parentheses have no special meaning in either mapping patterns or templates; they are just ordinary characters. This makes it easy to write entries that correspond to illegal addresses or partial addresses.

Also note that within a single $[...] construct, there can be multiple ranges of characters (c1-cn) and multiple lists of characters (c1c2...cn), mixed and matched.


Previous Next Contents Index