function cut(str,s1,s2) {
var r=new RegExp('^.*?'+s1+'|'+s2+'.*?$', 'g');
return str.replace(r, '');
}
alert(cut('text123872193871293871293871389helloHELPbye123712736127367text','hello','bye'));
alert(cut('text123872193871293871293871389rrrblablarrr123712736127367text','rrr','rrr'));