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

Clash Royale CLAN TAG#URR8PPPHow to make URL display as link with https along with current code for http in php?
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}[^ ]*?(?!<[^ .]))([ rn.])`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}[^ ]*?(?!<[^ ]))([ rn])`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
http:
https?:
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You should be able to just change
http:in your pattern tohttps?:– Nick
35 secs ago