with the usual โmagicโ setting you want to do
:s/] \[/][/
or more fancily
:s/]\zs\s\+\ze\[//
or with a magic level explicitly set in regular expression
:s/\V]\zs\s\+\ze[//
\ zs and \ ze limit the replacement of the region they enclose.
\ M completely disables magic, so every character or combination of characters, not a prefix with \ , is taken literally.
'magic' ( :help 'magic' ) is a global option that defines how potentially special characters are interpreted in regular expressions.
source share