Re: [PHP] How to recognise url in a block of text
Hello, Thanks Toby. The aim is to show the entire text taken from the database (mysql) with the link within the text showing as a clickable link. Not just to remove entirely. Regards, Bunmi www.ayserve.net www.budelak.com Toby Osbourn wrote: Hello, I would suggest first of all splitting the block of text into single words (I would assume you would use as the delimiter for this assuming the text stored on the database is readable and not just random words delimited by something else). The use the eregi() function to see if any of the words contain either www. or http://www. If they do simply store them in an array or directly output them to your page. Regards Toby On 17/10/06, *AYSERVE.NET http://AYSERVE.NET* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Please, I need help on how to to recognise url in a block of text being retrieved from a database and present it as a link within that text. I will appreciate any help. Regards, Bunmi -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.borninblood.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Empfangsbestätigung (angezeigt) - Re: [PHP] How to recognise url in a block of text
Sorry, I don't speak german. Regards, Bunmi www.ayserve.net, www.budelak.com [EMAIL PROTECTED] wrote: Dies ist eine Empfangsbestätigung für eine Nachricht, die Sie an [EMAIL PROTECTED] gesendet haben. Hinweis: Diese Empfangsbestätigung sagt nur aus, dass die Nachricht am Computer des Empfängers angezeigt wurde. Es gibt keine Garantie, dass der Empfänger die Nachrichteninhalte gelesen oder verstanden hat. Reporting-UA: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Final-Recipient: rfc822;[EMAIL PROTECTED] Original-Message-ID: [EMAIL PROTECTED] Disposition: manual-action/MDN-sent-manually; displayed Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Tue, 17 Oct 2006 10:17:06 +0200 Received: from lists.php.net ([216.92.131.4]) by mail.comtrance.net with esmtp (Exim 4.60) (envelope-from [EMAIL PROTECTED]) id 1GZk8H-sW-Ca for [EMAIL PROTECTED]; Tue, 17 Oct 2006 10:17:06 +0200 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:7357] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/03-04054-A1194354 for [EMAIL PROTECTED]; Tue, 17 Oct 2006 04:15:23 -0400 Received: (qmail 8561 invoked by uid 1010); 17 Oct 2006 08:15:16 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 8553 invoked by uid 1010); 17 Oct 2006 08:15:15 - Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ayserve.net from 70.84.85.66 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 70.84.85.66 bmw.websitewelcome.com Linux 2.6 Message-ID: [EMAIL PROTECTED] Disposition-Notification-To: AYSERVE.NET [EMAIL PROTECTED] Date: Tue, 17 Oct 2006 09:13:53 +0100 From: AYSERVE.NET [EMAIL PROTECTED] User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: Toby Osbourn [EMAIL PROTECTED], php-general@lists.php.net References: [EMAIL PROTECTED] [EMAIL PROTECTED] In-Reply-To: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bmw.websitewelcome.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - ayserve.net X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP] How to recognise url in a block of text -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to recognise url in a block of text
Thanks Alan. Retuen receipt disabled. Who can help regarding my problem below. I will appreciate any assistance. Regards, Bunmi www.ayserve.net., www.budelak.com AYSERVE.NET wrote: Hello, Thanks Toby. The aim is to show the entire text taken from the database (mysql) with the link within the text showing as a clickable link. Not just to remove entirely. Regards, Bunmi www.ayserve.net www.budelak.com Toby Osbourn wrote: Hello, I would suggest first of all splitting the block of text into single words (I would assume you would use as the delimiter for this assuming the text stored on the database is readable and not just random words delimited by something else). The use the eregi() function to see if any of the words contain either www. or http://www. If they do simply store them in an array or directly output them to your page. Regards Toby On 17/10/06, *AYSERVE.NET http://AYSERVE.NET* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Please, I need help on how to to recognise url in a block of text being retrieved from a database and present it as a link within that text. I will appreciate any help. Regards, Bunmi -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.borninblood.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to recognise url in a block of text
# [EMAIL PROTECTED] / 2006-10-17 15:13:50 +0100: Who can help regarding my problem below. I will appreciate any assistance. On 17/10/06, *AYSERVE.NET http://AYSERVE.NET* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Please, I need help on how to to recognise url in a block of text being retrieved from a database and present it as a link within that text. Study [REs] and [URIs]. come back with specific questions if you hit any problems. [REs] http://www.php.net/manual/en/ref.pcre.php [URIs] http://www.rfc-editor.org/rfc/rfc3986.txt -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to recognise url in a block of text
On Tue, October 17, 2006 2:39 am, AYSERVE.NET wrote: Please, I need help on how to to recognise url in a block of text being retrieved from a database and present it as a link within that text. read the User Contributed Notes at: http://php.net/preg_match_all and friends. There are only about 100 solutions there alone. Google for a thousand more. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to recognise url in a block of text
At 10/17/2006 12:39 AM, AYSERVE.NET wrote: Please, I need help on how to to recognise url in a block of text being retrieved from a database and present it as a link within that text. Here's an illustration of your problem: Input: Text text http://example.com/directory/filename.html#anchor text text http://www.example.com/filename.php?arg=valarg=val text text. Output: Text text a href=http://example.com/directory/filename.html#anchor;http://example.com/directory/filename.html#anchor/a text text a href=http://www.example.com/filename.php?arg=valarg=val;http://www.example.com/filename.php?arg=valarg=val/a text text. Method: - find each URL within the text - replace each URL with an anchor tag that includes two copies of the URL, one in the href attribute and one enclosed in the tag. Technique: I'd use Regular Expressions for this: PHP - Regular Expression Functions (Perl-Compatible) http://php.net/pcre To write your own regexp to identify URIs, you'll want to read the spec: RFC 1738 - Uniform Resource Locators (URL) http://www.faqs.org/rfcs/rfc1738.html Specifically you'll need to know what characters can and cannot occur in an URL, and in what context, so that you can separate an URL from surrounding text and punctuation such as parentheses, periods, commas, etc. If you google regular expression url you'll find a lot of examples of regexp's that find URLs, including: Regex for URLs by Abigail http://foad.org/~abigail/Perl/url2.html Have fun, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php