$('.title:contains("|")').each(function () { this.innerHTML = this.innerHTML.replace(/\|(.*)/, '<span>$1</span>'); });