Below code works on the Mootools library, I would like it to work on jQuery if possible, I so far had no luck.
HTML
<p id="test">@user has an email address of user@email.com. See! the regexp works @people!</p>
MooTools
$('test').set('html', $('test').get('html').replace(/\B\@([\w\-]+)/gim, function(match, name){
return '<a href="http://twitter.com/users/' + name + '">' + match + '</a>';
}));
Try this:
Example fiddle