, ignoring the (color) because it is in between ( and ). everything I have tried has failed miserably, and at this point I’m doubting if it is possible to do in a well-optimized manner. Any help is appreciated.
Oh.
What I am trying to make the block do is ignore everything in parentheses when splitting, since I do not always know what will be in the parentheses.
It’s a list separated by commas, but I don’t want it to separate anything in parentheses. This also goes for a few other functions part of the data that has parentheses in it. null, new Color(255, 230, 0), 9, 100, "hello", "world", true
After I change the string into a list using this split, I am going to change each item from a json item form into snap data except for the functions like the new color one.
I think it unlikely that you’ll find a single procedure in anyone’s string library that does exactly what you want.
Indeed, if you want this to be a library-quality (user-proof) block, you first have to specify what should happen in the case of nested parentheses in the text. That is, what should happen if, after you see an open paren, you see another open paren before you see a close paren? To do the general purpose right thing, you have to keep track of the current depth in parentheses at a given point in the string. And you have to handle syntax errors: What if you reach the end of the string while still inside parentheses, and what if you reach a close paren when you’re not inside parentheses? What if you see a parenthesis inside quotation marks? I would suggest that efficiency is the last thing for you to worry about.
I’m sure there’s some beautiful elegant functional way to do this, but in situations such as this one I admit I just throw up my hands and do it iteratively.
But I already see a bug; wherever it adds TOKEN to RESULT it should instead say
What was the change? they look the same to me, except the second one works perfectly.
I did decide to combine your 2 blocks which I did just for simplicity, but it was basically all you. Thanks so much for this help, you just saved me MANY hours.