Javascript String between(left, right)
String.prototype.between = function (left, right) { var s = this; var startPos = s.indexOf(left); var endPos = s.indexOf(right, startPos + left.length); if (endPos == -1 && right != null) return new this.constructor('') else if (endPos == -1 && right == null) return s.substring(startPos + left.length); else/*from ww w. j av a 2 s . c om*/ return s.slice(startPos + left.length, endPos); };