Converting a URL to a clickable hyperlink

Last update on April 7, 2009 09:28 AM by jak58
Published by jak58

Converting a URL to a clickable hyperlink








With regular expressions, it is possible to transform any hyperlink URL of the form
http://URL (or ftp://URL) or beginning with www. :

<?
$message = eregi_replace("((([ftp://])|(http(s?)://))((:alnum:|[-\%\.\?\=\#\_\:\&\/\~\+\@\,\;])*))","<a href = '\\0' target='_blank'>\\0</a>",$message);

$message = eregi_replace("(([^/])www\.|(^www\.))((:alnum:|[-\%\.\?\=\#\_\:\&\/\~\+\@\,\;])*)","\\2<a href = 'http://www.\\4' target='_blank'>www.\\4</a>",$message);
?>
Best answers for « Converting a URL to a clickable hyperlink » in :
How to convert a link to PDF Show How to convert a link to PDF Sometimes you want to easily convert a web page, a tutorial, e-mails, or else, in PDF format. Here is a small tip, helping you to achieve your goals: First go to this site: http://www.htm2pdf.co.uk/...
How to turn a URL into a hyperlink ShowHow to turn a URL into a hyperlink If you are using PHP, there is a simple way to turn a URL into a hyperlink when inserting the address into your PHP document. This process is mostly used to ease the users' search of external websites or...
How to convert a PPS file to PDF format? ShowHow to convert a PPS file to PDF format? Download OpenOffice Open the file Exporting Below is a tips of how to convert PPS file to PDF format and preserve the clickable link at the same. Download OpenOffice Download Openoffice...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Hyperlinks ShowIntroduction to anchors Hypertext links or hyperlinks (anchors) are HTML elements that, when clicked on, enable readers to visit a new address. Hyperlinked text is underlined by default. Hyperlinks are what connect web pages to one another. They...
URL ShowWhat is a URL? A URL (Uniform Resource Locator) is a universal naming format used to indicate a resource on the Internet. It is a printable ASCII character string which breaks down into five parts: The name of the protocol: i.e. in a way the...