function betweenMarkers(text, begin, end) {
var firstChar = text.indexOf(begin) + begin.length;
var lastChar = text.indexOf(end);
var newText = text.substring(firstChar, lastChar);
return newText;
}
console.log(betweenMarkers("MyLongString:StringIWant;",":",";"));
// StringIWant