regex practice
by Blake Plumb
HTML
<h4>Men's Basketball vs. Georgetown</h4>
<h4>Men's Basketball vs. team2</h4>
<h4>Men's Basketball vs. team3</h4>
<h4>Men's Basketball vs. team4</h4>
JavaScript
$('h4').each(function(){
var text = $(this).text(); //get the text of the h4
var re = "/(?<=vs.\s).*/";
var text = text.replace(re, '<span class="team"></span>');
alert(text);
// +text.match(/(?<=vs.).*/)+
});