Pattern Matching

Many parameters allow patterns to specify multiple sources to be selected or acted upon. CHOPs, channels, DATs, Geometry COMPs are examples of things that some parameters may allow multiple of. These patterns allow wild cards which will match all or parts of strings. Patterns are also used in various Python methods such as ops(), to allow specifying more than one OP by a single string.

Multiple patterns can be specified, separated by spaces. The patterns will be ORed together, so a source that matches any of listed patterns will be selected.

* - Match any sequence of characters

? - Match any single character

^ - Do not match.

[alphaset] - Match any one of alphabetic characters enclosed in the square brackets. In TouchDesigner, the [a-g] format is not currently supported, the characters must be listed as [abcdefg].

[num1-num2] or [num1-num2:increment] - Match any integer numbers enclosed in the number range, with the optional increment.

[num1,num2,num3] - Match the specific integers given.

@groupname - Expands all the items in the group. Since each group belongs to a network, you can specify a path before the @groupname identifier.

NOTE: The opposite of pattern matching is Pattern Expansion, takes a short string and generates a longer string from it.

Pattern matching is also often used to match channel names. It uses the following kinds of patterns to select existing channels in an input CHOP, used in CHOPs like the Select CHOP and the Math CHOP's Scope parameter, where you only want to affect certain channels and leave the rest as-is.

Pattern matching is used to match object names in the Render TOP, and OPs/channel names in the Select CHOP.