На ваш вкус.)
function searchBetween(str, first, second){
var fl = first.length,
sl = second.length,
f, s = -sl,
arr =[];
while((f = str.indexOf(first, s+sl)) !== -1 && (s = str.indexOf(second,f+fl)) !== -1 ){
arr.push(str.slice(f+fl, s))
}
return arr
}
function searchBetweenReg(str, first, second){
function escape(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
var result = [],
arr = str.split(new RegExp(escape(first) + '([\\s\\S]*?)' + escape(second),''));
for(var i=1, l = arr.length; i<l; i+=2 ) result.push(arr[i]);
return result
}
function searchBetweenReg2(str, first, second){
function escape(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
var reg = new RegExp( escape(first) + '([\\s\\S]*?)' + escape(second),'g'),
arr = [],
sub;
while((sub = reg.exec(str)) !== null) arr.push(sub[1]);
return arr
}