Re: Adding HTTP URL Code
| From: | Justin French | Date: | Thu, 09 Jan 2003 00:13:20 +0000 |
| Subject: | Re: Adding HTTP URL Code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130829@lists.php.net to get a copy of this message | ||
I think the reason you didn't get a reply is because no one could understand
what you wanted to happen.... my guess is...
You need a regular expression to turn URLs in a string into links.
So that this:
---
This is a test. It is only a test.
What happens when I include a URL in my results text?
http://not.a.real.url/programs
This is only a test
---
becomes:
---
This is a test. It is only a test.
What happens when I include a URL in my results text?
<a href="http://not.a.real.url/programs">http://not.a.real.url/programs</a>
This is only a test
---
Correct? Let us know, and I'm sure someone can help you out.
FWIW it's been asked MANY times, so a search of the archives might help.
Justin
on 09/01/03 7:07 AM, ELLIOTT,KATHERINE A (HP-FtCollins,ex1)
(katherine.elliott@hp.com) wrote:
> OK, so I've gotten NO responses to my query below so I
> thought I'd ask for something slightly different and see what
> I get.
>
> If I have a bunch of plain text data, how can I pull out the
> strings containing "http". I've tried several different things
> but what I end up with is more or less than what I want.
> Once I have this, I can add the URL code and replace the
> string but I haven't figured out how to do this.
>
> For example, what would I do if my text looks like this (not
> including the astrices):
>
> ******************************************************
> This is a test. It is only a test.
> What happens when I include a URL in my results text?
>
> http://not.a.real.url/programs
>
> This is only a test
> ******************************************************
>
> Anyone? Anyone?
>
> Thanks,
>
> Katherine
>
> -----Original Message-----
> From: ELLIOTT,KATHERINE A (HP-FtCollins,ex1)
> [mailto:katherine.elliott@hp.com]
> Sent: Tuesday, January 07, 2003 2:36 PM
> To: php-general@lists.php.net
> Subject: [PHP] Adding HTTP URL Code
>
>
> Hello,
>
> I have a string of data that can be anywhere from one line (a single URL)
> to many, many lines. The data is in plain text but, as I alluded, may
> contain
> one or more URLs (or none). I then take this data and put it on a web page
> so I would like to make any URLs in the data live. Has anyone on the list
> done
> this? If so, can you tell me how? I'm stumped.
>
> Thanks,
>
> Katherine