I have a string that and I am trying to extract the characters before the quote.
Example is extract the 14 from 14\' - €14.99
I
This is the what you should use to split:
string.slice(0, string.indexOf("'"));
And then to handle your non existant value edge case:
function split(str) { var i = str.indexOf("'"); if(i > 0) return str.slice(0, i); else return ""; }
Demo on JsFiddle