Difference between revisions of "Pattern Replacement"
|Line 14:||Line 14:|
And the Rename
And the Rename has
as it's entry. You can pull out what was matched
as it's entry. You can pull out what was matched the first and the using *(0) and *(1).
A pattern of
Revision as of 15:56, 25 March 2019
Pattern Replacement takes place in a 2nd parameter after a Pattern Matching parameter, 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
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
Will result in the channel names
monitor_floor_left projector_floor_right led_floor_top
Pattern Replacement occurs in:
Used in conjunction with Pattern Matching to replace all or portions of matched strings with new data. Used in places such as the Rename CHOP.