Look ahead and look behind assertions are perfect for this sort of thing. In this case, negative assertions can make sure that the extra pattern you specify (i.e. the backslash) doesn't occur:
m/(?<!\\)\[.*?\](?!\\)/g should do what you want.
Update: jeffa pointed out my .?* should in fact be a .*?
elbieelbieelbie
In reply to (elbie): regex for but not \\
by elbie
in thread regex for [ but not \[
by shockme
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |