Using wildcards

OpenSwitch allows you to use wildcard expressions in its configuration file to represent values for the connection attributes.

If a you use a wildcard expression to define an attribute under the [POOL] connections section, for example:

[POOL=POOL1:MODE=CHAINED,CACHE=0]
connections:
username=[abcde]%

Then all users whose user names start with any letter from “a” to “e” are channeled to POOL1.

If you use a wildcard expression to define an attribute under the [LIMIT_RESOURCE] section, for example:

[LIMIT_RESOURCE:ACTION=KILL,BUSY=100]
appname: [ei]sql

Then an application with the name of “esql” or “isql” is governed by the resource monitor and killed if it spends longer than 100 seconds in a transaction.

OpenSwitch wildcard expressions are identical to those used in Adaptive Server Enterprise, except for the escape expression.

Brackets ([ ])

Use square brackets ([ ]) to enclose a range of characters, such as “[a–f]”, or a set of characters, such as “[85Rza].” When ranges are used such as [char1-char2], all values in the ASCII range between char1 and char2 match.

For example, if you use 8-bit ASCII, “[0–z]” matches 0–9, A–Z, and a–z, as well as several punctuation characters.

The wildcard expression: [dD]og matches these strings:

dog 
Dog

The wildcard expression [A-Z]at matches these strings:

Pat 
Hat 
Cat

Caret (^)

When included as the first character within a set of brackets, you can use the caret symbol (^) to negate matching a set of characters within the brackets.

For example, the expression: “[^A–Z]at” matches these strings:

cat 
hat 
pat

It does not, however, match:

Cat 
Hat 
Pat

Escape (\)

Use the escape (\) wildcard to negate special meaning of another wildcard character. For example, to include the “%” as a literal part of an expression, “90\%” matches the string 90%.

You can use the escape wildcard to negate the meaning of any character within a wildcard expression.

Percent (%)

The percent (%) wildcard represents a string of zero or more characters. For example, the wildcard expression “sco%” matches these strings:

scott 
scooter 
scope 

But it does not match:

escort

Underscore (_)

The underscore (_) wildcard matches any single character. For example, the expression “_op” matches these strings:

pop 
mop 
top

But it does not match:

stop