Created
June 22, 2013 12:43
-
-
Save Usse/5840747 to your computer and use it in GitHub Desktop.
Wrap with an <a> element all the mention occurrences in a string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_if_mention : function(string) { | |
var thestring=string; | |
var pattern = /@([a-zA-Z0-9_]+)/g; | |
return thestring.replace(pattern, "<a href='http://twitter.com/$1' target='_blank'>@$1</a>"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment