Re: Help with preg_match_all regex for alt tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joe Harman 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

preg_match_all('/alt="[^"]*["]/i', $output, $alt_tags);

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux