Created
June 1, 2011 21:09
-
-
Save md2perpe/1003330 to your computer and use it in GitHub Desktop.
Twitter hashtag link base
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
<?php | |
$tweet = 'Detta är ett #test för min blog... #ignoreme #lördag #måla #mäktigt #coolt #åsa-nisse #()lol()'; | |
$pattern = '/#(\pL+)/'; | |
$replacement = '<a href="#$1">$0</a>'; | |
echo preg_replace($pattern, $replacement, $tweet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment