Great Video, the Level 7 impressed me so much. I replaced matching pairs with a placeholder and also Pairs, that only contained my placeholder as well with a placeholder. so "()" became "oo" and "(oo)" became "oooo" and so on with each type of bracket. After that i searched for the different closing brackets and took the min, as my string was still the same length as in the beginning. but your solution is smart and elegant, just insane. you keep blowing my mind and I keep learning from you, thank you so much ☺
@DimEarlyАй бұрын
Thanks Jean! JvdV posted this solution on LinkedIn, which takes a pretty similar approach (with a very nice regex): =LEN(REGEXEXTRACT(REDUCE(,ROW(1:99),LAMBDA(x,y,REGEXREPLACE(x,"\[(a*)]|\((a*)\)|\{(a*)}","a$1$2$3a"))),".*?[\]})]")) How did you do the replacement? I'm guessing REDUCE / SUBSTITUTE?
@JeanWollehАй бұрын
@DimEarly I used REDUCE and also regex, but i didnt know how to define my placement without REPT. So i used a similar pattern, but to define the to replace with, i used REGEXEXTRACT with the same pattern und took the LEN: =REDUCE(G259,SEQUENCE(50),LAMBDA(in,cur,IFERROR(REGEXREPLACE(in,"\((o*)\)|\{(o*)\}|\[(o*)\]",REPT("o",LEN(REGEXEXTRACT(in,"\((o*)\)|\{(o*)\}|\[(o*)\]"))),1),in))) I had no idea how to keep my string at the same length otherwise. I have to do some Research on the pattern used in the formula from JvdV, i don't understand it yet
@JeanWollehАй бұрын
ok i Think I atleast get the idea, the $1 is for the first capture group. so if a group captures something, the content stays, as i replace only the brackets and keep the groups, if there is any. and as the groups are only the letters, not the brackets, it works.
@DimEarlyАй бұрын
@@JeanWolleh Yes, exactly 👍🏻 If you want to learn some more advanced regex, I would definitely follow JvdV. Also, regex101.com is a great resource if you’re trying to understand what a particular pattern does (I needed it to remind me what the lazy operator in the outer regex was doing).
@HarryjackgrossАй бұрын
Tonight I will dream of a 700ft Evil Dim looking down on London and reaching out as orchestral music plays