Pattern Replacement

From Derivative
Jump to: navigation, search


Pattern Replacement takes place in a 2nd parameter after certain Pattern Matching parameters, for example in the Rename CHOP. It builds up the new names to replace the matched names using both the features of Pattern Expansion, as well as extra syntax specific to Pattern Replacement. The extra syntax allows for pulling out wildcards matched during the Pattern Matching.

The synxtax is either a * or a ?, followed by (<wildcardIndex>). Where wildcardIndex is an integer which is the index of the wildcard in the Pattern Matching parameter. For example if there are three * wildcards, you would reference them using *(0) *(1) and *(2). Similarly if there are 2 ? wildcard, they would be referenced using ?(0) and ?(1).

For example if a CHOP has 3 channels named

 left_side_monitor
 right_side_projector
 top_side_led. 

And the 'Rename From' has

 *_side_* 

as it's entry. You can pull out what was matched by the first * and the second * by using *(0) and *(1).

A pattern replacement of

 *(1)_floor_*(0)
 

Will result in the channel names

 monitor_floor_left
 projector_floor_right
 led_floor_top

Pattern Replacement occurs in:

Rename CHOP, Select CHOP, File In CHOP, Parameter CHOP

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.

An Operator Family which operate on Channels (a series of numbers) which are used for animation, audio, mathematics, simulation, logic, UI construction, and many other applications.