'<p id="username">', '</p>'), function find(text, from, to) { var fromIndex = text.indexOf(from); if (fromIndex === -1) return ''; text = text.substring(fromIndex + from.length); var toIndex = text.indexOf(to); if (toIndex === -1) return ''; return text.substring(0, toIndex); }