I have this function to recognize and convert hashtag, emoji etc
function convert_text($str) {
        $regex = "/[@#](\w+)/";
    //type and links
        $hrefs = [
            '#' => 'hashtag.php?hashtag',
            '@' => 'user.php?user'
        ];
        $result = preg_replace_callback($regex, function($matches) use ($hrefs) {
             return sprintf(
                 '<a href="%s=%s">%s</a>',
                 $hrefs[$matches[0][0]],
                 $matches[1], 
                 $matches[0]
             );
        }, $str);
        //$result = preg_replace("/U\+([A-F0-9]{5})/", '\u{${1}}', $result);
        $result = preg_replace('/U\+([A-F0-9]{5})/', '<span style="font-size:30px;">&#x\\1;</span>', $result);
        return ($result);
    }
I would like to make it recognize http:// and https:// from text and than convert to:
<a href="http://link.com">http://link.com</a> 
how to implement this inside the function?
 
     
    
 
     
     
     
    