I've found a lot of regex examples for matching content within nested brackets, but what I want to do is match:
- a function with a particular name
- match ALL content inside the curly braces (including any NESTED curly braces)
For example:
function someFunc() {
const a = 6;
if (a === 7) {
while (true) {
break;
}
}
}
This should find function someFunc
+ignore anything up to first curly+then match all contents within the curly braces, including any nested braces.
I'm a noob at regex so I can't show you what I've done, I've been looking at Regex to get string between curly braces "{I want what's between the curly braces}" but none of them are suitable. Thanks!
PS expected output is a capture group of all contents within a function (which I can then replace).