Regex function for adding link tags in PHP. Thanks to seebz.net for this.