remove spaces in square brackets