Created
July 26, 2013 13:05
-
-
Save ChristianGaertner/6088700 to your computer and use it in GitHub Desktop.
Convert Links into HTML anchors with ease.
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
| public static function convertLinks(&$input) { | |
| $input = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.-]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $input); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment