Related questions
your_string.substr(0, your_string.indexOf(keyword) );
your_string.match(/^.*(?=Test)/);
Find more questions by tags JavaScript