Range Compared with a Pattern (Special Character String) for the Add Attribute Command

This form, used exclusively for character strings, uses a special character string called a pattern.

range PATTERN_OPERATOR PATTERN

Patterns are powerful tools for defining ranges because they can include wildcard characters. Wildcard characters can be used to represent a single digit or a group of characters. This allows you to define large ranges of valid values.

For example, you can define an attribute’s range as “DR* REV*” where the asterisk (*) is a wildcard representing any character or characters. This range allows the user to enter any value, as long as the first half begins with the letters “DR” and the second half begins with the letters “REV”.

When using a pattern to define a range, you must use a pattern operator. These operators compare the user’s value with the pattern range. All the pattern operators allow for wildcard comparisons. Two of them check the user’s entry for an exact match (including checks for uppercase and lowercase).

Operator Operator Name Function
match or ~= match The user's character string must match the exact pattern value given, including uppercase and lowercase letters. For example, "Red Robin" is not a sensitive match for the pattern value "re*ro*" since the uppercase R's do not match the pattern.
!match or !~= not match The user's character string must not match the exact pattern value. For example, if the user enters "Red" when the pattern value is "red", the value is allowed; "Red" is not an exact match to "red".
smatch or ~~ string match The user's character string must match only the general pattern value, independent of case. Case is ignored so that "RED" is considered a match for "red".
!smatch or !~~ not string match The user's character string must not match the general pattern value, independent of case. For example, assume the range pattern is defined as "re*ro*". The value "Red Robin" is not allowed, although "red ribbon" is allowed. That is because the first value is a pattern match (regardless of case difference) and the second is not.

When the user enters a character string value, these operators compare that value to the defined range pattern. If the comparison results in a true value, the user value is considered valid and is assigned to the attribute. If the comparison is false, the user value is considered out of range and is not valid.