I need to find a Regex in C# that is matching and returning strings from a nested structre delimited by $( and )$.
My input string is:
$(string1$(string2)$sometexthere$(string3$(string4)$texttext)$anothertext)$
The output must be :
$(string1$(string2)$sometexthere$(string3$(string4)$texttext)$anothertext)$
$(string2)$
$(string3$(string4)$texttext)$
$(string4)$
I have tried with this regex \$\([^\$]*\)\$ but it's only returning the most inner string2 and string4.
Is there a solution to return each match with regex ? or even through a loop ? ( $( and )$ can be replaced after by [ and ] )
