RE: [PHP] Preg_match question
| From: | Dave Carrera | Date: | Sat, 29 May 2004 12:51:22 +0000 |
| Subject: | RE: [PHP] Preg_match question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187189@lists.php.net to get a copy of this message | ||
Thanks Marco,
I worked it out, with trial and error but I will refine what I have by
reading your examples.
Is there a preg to find a "?" in a string since a "?" is used for
calculations as I see it.
Thank you and others for all the help with this
Dave Carrera
-----Original Message-----
From: Marco Tabini [mailto:marcot@tabini.ca]
Sent: 29 May 2004 13:32
To: 'Dave Carrera'; php-general@lists.php.net
Subject: RE: [PHP] Preg_match question
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:dave@ephgroup.com]
> Sent: May 29, 2004 4:30 AM
> To: php-general@lists.php.net
> 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
---
Incoming 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
---
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