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
This matches everything except square brackets: [^\[\]]+
This captures anything that is not a square bracket between any number of open (LHS) and close (RHS) square brackets:
\[+([^\[\]]+)\]+
Example usage in Javascript:
'[[[[[test]]]]'.match(/\[+([^\[\]]+)\]+/)
> ["[[[[[test]]]]", "test"]
The regex tester at http://regexpal.com/ is useful for trying out regexes.