I'm writing a code formatter and I need some help. I have to find the code blocks and I want to use regular expressions. The code I need to format looks basically like this:
KEYWORD name {
word
word
...
}
I am able to find the blocks that start with { and end with } with this expression:
[{](.*?)[}]
But I don't know how to add the "KEYWORD name" part to the expression. Both are custom strings that can contain any character except ;, { and }.
Another problem is that my code blocks can be nested. I don't know how to add that feature.