The original character class `[^\\\[\\]]` escapes `\\` instead of `\]` (e.g. it would be the character class `[^\\\[]` followed by a `]` which I think is wrong).