xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
document.getElementById('response').innerHTML = xhr.responseText;
someOtherCallback(xhr.responseText);
}
}
var parts = 'слово1 слово2 [слово слово слово] слово3 [слово] [слово слово ] слово4'.split(' ');
var res = [], flag = false;
for(var i = 0, il = parts.length; i < il; ++i){
var f = flag;
if(parts[i][0] === '[') flag = true;
if(parts[i][parts[i].length-1] === ']') flag = false;
if(f) res[res.length-1] += ' '+parts[i];
else res[res.length] = parts[i];
}
console.log(res);