DataTree rule notation

grasshopper

(S72r91) #1

Hi,

I am trying to replace data tree paths but I’m having trouble understanding the difference between rule notations {*} and {?}.I have read https://www.grasshopper3d.com/forum/topics/datatree-selection-rules which explains that:

* Any number of integers in a path
? Any single integer

The asterisk achieves what I’m trying to do, but I would still like to know how they are different exactly. I have attached a screen capture for reference. Thanks.


(David Rutten) #2

The asterisk represents any number of integers, including zero. The question mark represents any single integer. So assuming a path which looks like {0;1;2}, you’ll get a match with {?;?;?} and with {?;?;2} but not with {?;?}.

When using asterisks, you have a lot more flexibility. {*} will match any imaginable path. {*;2} will match any path ending in 2. {*;2;*} will match any path containing 2, even if it only starts or ends with a 2.


(S72r91) #3

Ahhhh it makes sense now. Thank you.