s/\)([^()]+)\(/]$1\[/g; # '[' is not a metachar here