View Single Post
Old 03-11-2006, 08:36 PM  
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Quote:
Originally Posted by BigBen
Thanks for the help. What can I use to match just the image name from the string extracted from the first match?

Ie. How do I match just pic.jpg out of: src="http://example.com/images/pic.jpg"

I tried: preg_match("/\/.+?\.jpg/", $matches[1], $imagematch);
but that matches the longest string possible (//example.com/images/pic.jpg)

Thanks.
Maybe do a greedy match at first, just to get all the full & relative paths to the actual images grabbed out of the src tags. Then implode that $matched array into a string. Against that string, do a more refined match to just grab out the image names.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote