Re: Get text between <a href=""> </a>
| From: | Christian Reiniger | Date: | Tue, 06 Mar 2001 13:24:04 +0000 |
| Subject: | Re: Get text between <a href=""> </a> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42745@lists.php.net to get a copy of this message | ||
On Monday 05 March 2001 23:09, you wrote:
> I need some help with a program, I need to get every
> instance of text between <a href => GET TEXT HERE
> </a> and save the results in a variable. Does anyone
> have some example code of how to do it along with how
> to put the results into just one variable?
Hmm, try
preg_match_all ('/<a\s+href[^>]+>([^<]+)<\/a>/', $Subject, $Matches);
$Matches [0] [1],
$Matches [1] [1],
$Matches [2] [1]
etc
will contain the text afterwards.
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Pretty cool, the kind of power information technology puts in our hands
these days.
- Securityfocus on probing 36000000 hosts for known problems in 3 weeks