Created
June 9, 2011 02:24
-
-
Save endel/1015918 to your computer and use it in GitHub Desktop.
Helper to fill twitter texts with links.
This file contains 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
tweet = "Hi, you should follow @endel! http://bugfixer.endel.me is #cool :)"; | |
tweet = tweet.replace(/(http\:\/\/[A-Za-z0-9\/\.\?\=\-]*)/g,'<a href="$1">$1</a>'); | |
tweet = tweet.replace(/@([A-Za-z0-9\/_]*)/g,'<a href="http://twitter.com/$1">@$1</a>'); | |
tweet = tweet.replace(/#([A-Za-z0-9\/\.]*)/g,'<a href="http://twitter.com/search?q=$1">#$1</a>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment