Re: [PHP] Help with preg_match_all regex for alt tags

[email protected] ("James Dempster")
Newsgroups php.general
Message-ID <[email protected]>
try preg_match_all('/<img[^>]*alt="([^"]*)"/i', $subject, $result);

--
/James

On Tue, Apr 29, 2008 at 8:18 PM, Joe Harman <[email protected]> wrote:

> Hey y'all ... i am having alittle trouble with this regex for finding
> ALT tags for images...
>
>
> Here is my statement
>
> --------------------------------------------------------------------------------------------------------------------------------
> preg_match_all("'alt[^>]*?>.*?[^>]'si", $output, $alt_tags);
>
> Evaluating
>
> --------------------------------------------------------------------------------------------------------------------------------
> [other html code]... <img src="images/race-parts_wheels-tires.jpg"
> vspace="2" border="0" alt="Wheel & Tire Acc" /> ...[other html code]
>
> I am currently getting
>
> --------------------------------------------------------------------------------------------------------------------------------
> alt="Wheel & Tire Acc" /><
>
> I want this result
>
> --------------------------------------------------------------------------------------------------------------------------------
> alt="Shopping Cart"
>
>
> Thanks for your help
> --
> Joe Harman
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.