should help explain it..
Code:
/
(
\[
[
^\[\]
]
+
\]
)
/
1st is the opening delimeter, you probably know about these.
2nd is opening of a group
3rd is the escaped opening square bracket; so that the regex engine takes it as a literal.
4th is the opening square bracket (non-escaped) to indicate we are opening a selection of character patterns.
5th is the pattern of what we want to match within the square brackets; we tell it to match everything
except for square brackets (when in a selection '^' is 'negate',) because we are using them as tokens.
6th is the closing square bracket (un-escaped) to indicate the pattern for characters has ended.
7th is the symbol to inicate we must match one or more of these patterns; else it would match "nothing" or "anything" to the pattern and we cold end up with the entire string being replaced.
8th is the closing group bracket
9th is the closing delimeter.
Now that I think of it some more, the group may be uneccessary.