builds split expressions in js
//builds a regex and splits by it from array of strings.
function buildsplitexp(arr) {
var regex = "(";
for(var i=0;i<arr.length;i++) {
var temp = arr[i].split("");
for(var j=0;j<temp.length;j++) {
regex += "\\" + temp[j];
}
regex += ")|(";
}
regex = regex.slice(0, regex.length-2);
return new RegExp(regex);
}