I was in a coding group and someone challenged us to write a regex to match everything outside of balanced brackets: https://i.stack.imgur.com/P2T34.png
The input:
Quiz: (Find all text that) outside of the outmost balanced parenthesis. (Be careful since) there might (be ((nested)) ones!) :) (async () => await console.log(1))()) You can do it! ()()(())():((1)((((((2)((3)))))))It would be even better the text is consecutive (and no more unneccessary (capturing groups!))() 2 * (1 + 3) = 8(eight) :( Did you do it ? (no) yes
The output:
Quiz:
outside of the outmost balanced parenthesis.
there might
:)
...
I know it's not a "real" question to ask but I really want to know the answer. I searched online how to match the opposite: https://regex101.com/r/pr58AX/1 but I'm really curious about how to match everything except the brackets. Is it possible?