I guess the simplest would be to use preg_match_all on 

'/<a +href="([^"]+)">/i'

Assuming that all your links are in that format, this will extract all the
contents of the href portion of the links in your string. There was a regex
series on our magazine that also covered more complex examples of this kind.

Cheers,


Marco

--
php|architect - The Magazine for PHP Professionals
http://www.phparch.com <-- Get your free issue today!

> -----Original Message-----
> From: Dave Carrera [mailto:[EMAIL PROTECTED]
> Sent: May 29, 2004 4:30 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Preg_match question
> 
> Hi List,
> 
> I have managed to list files on my website using a combination of
> preg_match_all and str_replace in an array.
> 
> What I would like to know is how do I lift out of a <a> tag the contents
> from href=".
> 
> Example:
> 
> Link returned = <a href="./somepage.php">Of to some page</a>
> 
> The bit I want to play with is ./somepage.php.
> 
> I think it might be something to do with another preg of some kind but I
> can
> not work it our so I ask for help from the list.
> 
> Thank you in advance for any help or guidance you my give
> 
> Dave C
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.691 / Virus Database: 452 - Release Date: 26/05/2004
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to