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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How 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





You should be able to just change http: in your pattern to https?:
– Nick
35 secs ago


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.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived