Re: stripping an HREF out of a line of text
| From: | Maurizio Firmani | Date: | Fri, 15 Sep 2000 07:44:06 +0000 |
| Subject: | Re: stripping an HREF out of a line of text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16917@lists.php.net to get a copy of this message | ||
Il ven, 15 set 2000, hai scritto:
> If you've got a bunch of code on one line, and you want to stript out an
> HREF (say you've got--all one one line)
>
> - - Cut here - -
>
> <tr valign="top"><td width="14"><img
> src="/desktop/images/bullet.gif"
> alt="*" width="14" height="9" border="0"
> hspace="0" vspace="0"></td><td><A
> HREF="/2000/LAW/09/14/wenholee.reno/index.html" TARGET="opener"
> class="Link">Reno offers no apology for Wen Ho Lee
> case</A></td></tr>
>
> - - End Text - -
>
> how can I use either eregi or eregi replace to get
> "/2000/LAW/09/14/wenholee.reno/index.html"?
>
> TIA!
>
preg_match("/HREF=\"([^\"]+)/i", $line, $match);
echo $match[1];
In $match[1] (which is an array) you will find the url.
HTH
Maurizio