Pattern matching is a text-based method for selecting multiple shapes or points at once. It’s used in parameters like Group and Indices in nodes such as Group, Light, and Transform.
There are two types of pattern matching: Name matching for selecting items by their label, and Index matching for selecting items by their position.
Name/ID Matching
This method is used to select shapes based on their Label or internal ID. You can also target specific shapes by their numeric Index (e.g. 0, 1, 0-5) directly in this field.
- Wildcards: use
*to match any sequence of characters and?to match any single character. - Exclusion: start a pattern with
^to exclude items that match. - Multiple patterns: separate multiple patterns with a comma
,to combine selections.
| To match... | Use pattern | Description |
|---|---|---|
all items starting with "Rectangle" | Rectangle* | The * acts as a wildcard for any number of characters. |
all items with "Temp" in their name | *Temp* | Wildcards can be used at the beginning and end of a pattern. |
"Shape 1", "Shape 2", "Shape A", etc. | Shape ? | The ? is a wildcard for a single character. |
all except those starting with "Box" | ^Box* | The ^ character at the start of a pattern excludes matching items. |
starting with "Rect", "Shape 1" | Rect*, Shape 1 | Commas are used to combine multiple patterns. |
all items | * | A single wildcard matches everything. An empty pattern also works. |
Index Matching
This method is used to select items based on their numerical order (index). This is common for selecting points within a shape or shapes within a stream of data. Indices are zero-based, meaning the first item is at index 0.
- Ranges: use a hyphen
-to select a range of indices (e.g.,1-5). - Open-ended ranges: leave one side of a range empty to select from the beginning or to the end (e.g.,
2-selects from index 2 to the last item). - Relative indices: use negative numbers to select items counting from the end of the list (e.g.,
-1is the last item). - Exclusion: start a pattern with
^to exclude specific indices from the selection. - Multiple patterns: separate multiple patterns with a comma
,.
Note: First item will be index 0, not 1, because count starts from 0.
| To match... | Use pattern | Description |
|---|---|---|
only 6th item | 5 | Indices are zero-based, so the 6th item is at index 5. |
last item | -1 | Negative indices count backwards from the end. |
second to last item | -2 | Selects the item immediately before the last one. |
2nd through 6th items | 1-5 | Selects an inclusive range of indices. |
all items from the 3rd item onwards | 2- | An open-ended range selects from the start index to the end of the list. |
first 4 items (indices 0 to 3) | -3 | An open-ended range selects from the beginning up to the end index. |
all items except the first one | ^0 | The ^ character excludes the specified index or range. |
2nd, 4th, and 6th items | 1, 3, 5 | Commas are used to select multiple specific indices. |
items 1-11 and 13 onwards, but not item 6 | 0-10, ^5, 12- | Patterns are evaluated in order: inclusions are added, then exclusions are removed. |
all items | * or (empty) | A wildcard or an empty string selects all available indices. |