I need to find a regular expression for use in C# (JavaScript as well), for get the text inside the either square brackets combination.

I try several ways, but I give up, always my combination have a some errors, somebody can help me please?

```
[text]

[[text]]

[[[tex]]]]]]]]]]]]]

```

etc...