Matching topic strings

The wildcard characters recognized by WebSphere MQ Publish/Subscribe are:

*
Zero or more characters
?
One character

In the example shown in Figure 1, the high-level topic of 'Sport' might be divided into separate topics covering different sports, such as:

Sport/Soccer
Sport/Golf
Sport/Tennis

These might be divided further, to separate different types of information about each sport, such as:

Sport/Soccer/Fixtures
Sport/Soccer/Results
Sport/Soccer/Reports
Note:
WebSphere MQ Publish/Subscribe does not recognize that the '/' character is being used in a special way. However, it is recommended that the '/' character is used as a separator to ensure compatibility with other WebSphere(R) business integration functions.

The following topic strings could be used in subscriptions to retrieve particular sets of information:

*
All information on Sport, Stock, Films and TV.
Sport/*
All information on Soccer, Golf and Tennis.
Sport/Soccer/*
All information on Soccer (Fixtures, Results and Reports).
Sport/*/Results
All Results for Soccer, Golf and Tennis.

Note that wildcards do not span streams (see Streams).

The percent character '%' is used as an escape character, to allow these characters to be used in a topic string. For example, the string 'ABC%*D' represents the actual topic ABC*D. If the string ABC%*D is specified in a Publish message (where wildcard characters are not allowed), the string could be matched by a subscriber specifying the string ABC?D.

To use a % character in a topic string, specify two percent characters '%%'. A percent character in a string must always be followed by a '*', a '?', or another '%' character.

If wildcard characters are not allowed in a message, a '*' or '?' character can be present only if it is immediately preceded by a '%' character so that the '*' or '?' character loses its wildcard semantics. Therefore, ABC%*D is a valid topic string in a Publish message but ABC*D is not.