How to make URL display as link with https along with current code for http in php?

60 Views Asked by At

Thank you for your help.

I currently am using the following code to return URLs as live links on My site:


//$bodymessage=preg_replace('`((?!##RAQ.*?##)(?<!@)\s[A-Z0-9._-]*\.[A-Z]{2,3}[^ ]*?(?!<[^ \.]))([ \r\n\.])`sim', '##RAQ_URL1##\1..\2##RAQ_URL1##', $bodymessage);

$a_search = array
 (
 '`((?!##RAQ.*?##)[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z0-9._%-]{2,4})\b`sim',
 '`((?!##RAQ.*?##)(?<!@)http://[A-Z0-9._-]*\.[A-Z]{2,3}[^ ]*?(?!<[^ ]))([ \r\n])`sim',
 '`##RAQ_URL1##(.*?)\.\.(.*?)##RAQ_URL1##`sim',
 '`##RAQ_EMAIL##(.*?)##RAQ_EMAIL##`sim',
 );


$a_replace = array
 (
 '##RAQ_EMAIL##\1##RAQ_EMAIL##',
 '##RAQ_URL1##\1..\2##RAQ_URL1##',
 '<a href="\1">\1</a>\2',
 '<a href="mailto:\1">\1</a>',
 );

$message = nl2br(preg_replace($a_search, $a_replace, $bodymessage));

The script currently displays any 'http' detected into an URL... What I'm looking to do is make BOTH 'https' AND 'http' display as an URL...

Thank you very much for your help!

:D

0

There are 0 best solutions below