I have some kind of this file
...some other block above also with a { block }
Main: Subroutine( )
{ <--
Include(foo = bar )
Call(foo = bar )
Repeat(foo = ibar )
{
Message("Message = bar number {ibar}" foo )
Something( )
Message("Message = foo {bar}" )
}
Message("Message = again {iterations}" )
For(start = foo , end = bar )
{
Comment( )
}
While(foo )
{
Comment( )
}
Comment( )
} <--
... some other block below also with a { block }
I need to match everything between the parent brackets marked with <-- and I came up with this
/^Main:\s*\w*\(\s*\)\s*\{\s*((?:.*\s*)*?)\}$/gm
but it stops after the } of the first nested block and I cant figure out how to reach the last bracket.
Is there any way to match until the curly bracket right in front of a new line?
Thanks!
Edit: Maybe I should add, that n nested { } blocks are possible