Re: Help with preg_match_all regex for alt tags
| From: | Shawn McKenzie | Date: | Tue, 29 Apr 2008 20:24:44 +0000 |
| Subject: | Re: Help with preg_match_all regex for alt tags | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273711@lists.php.net to get a copy of this message | ||
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 helppreg_match_all('/alt="[^"]*["]/i', $output, $alt_tags);