I'm afraid you will need to use regular expressions for that. In order to get the text before span element use something like this:
var txt = $('span').parent().html();
var regex = /(.*)/;
txt = txt.match(regex)[1];
Modify the regex to match other parts of the string as well.