How do I structure this Regex?

Experts,

I am new to Regex.  

What Regex would I use to get the result of only:
40294a.jpg
40294b.jpg
40294c.jpg
40294d.jpg

I am attempting to get all 4 results in an array, however, I am only able to get one result.   Please note: The stock number of "40294" will change on each product.  

Thanks for your help!!



// My Code gets only one reult of 40294.jpg.

preg_match('%<img src="/product-images/40294/50/(.*?).jpg" style="border:solid 1px #D6D6D6; border-collapse:separate;" />%s',$data,$matches3);

$photos1=$matches3[1];
$photos2=$matches3[2];
$photos3=$matches3[3];
$photos4=$matches3[4];

echo $photos1."<br />";
echo $photos2."<br />";
echo $photos3."<br />";
echo $photos4."<br />";



// Source Code ***********************************

<div style="float:left; padding-left:3px;">                        
                     
					    <a href="hires-image-viewer.asp?sku=40294&image=0" 
					       target="_blank"
					       rel="nofollow"
					       onclick="return displayHiResImageViewer('40294', 0);"					       
					       style="display:inline; float:left; border-style:none;  margin-left:-1px; ">
					        <img src="/product-images/40294/50/40294a.jpg" style="border:solid 1px #D6D6D6; border-collapse:separate;" />
					    </a>
					    
					    <a href="hires-image-viewer.asp?sku=40294&image=1" 
					       target="_blank"
					       rel="nofollow"
					       onclick="return displayHiResImageViewer('40294', 1);"					       
					       style="display:inline; float:left; border-style:none;  margin-left:-1px; ">
					        <img src="/product-images/40294/50/40294b.jpg" style="border:solid 1px #D6D6D6; border-collapse:separate;" />
					    </a>
					    
					    <a href="hires-image-viewer.asp?sku=40294&image=2" 
					       target="_blank"
					       rel="nofollow"
					       onclick="return displayHiResImageViewer('40294', 2);"					       
					       style="display:inline; float:left; border-style:none;  margin-left:-1px; ">
					        <img src="/product-images/40294/50/40294c.jpg" style="border:solid 1px #D6D6D6; border-collapse:separate;" />
					    </a>
					    
					    <a href="hires-image-viewer.asp?sku=40294&image=3" 
					       target="_blank"
					       rel="nofollow"
					       onclick="return displayHiResImageViewer('40294', 3);"					       
					       style="display:inline; float:left; border-style:none;  margin-left:-1px; ">
					        <img src="/product-images/40294/50/40294d.jpg" style="border:solid 1px #D6D6D6; border-collapse:separate;" />
					    </a>
					    
				    </div>

Open in new window

rlb1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amit_gCommented:
preg_match_all('%<img src="/product-images/40294/50/(.*?).jpg" style="border:sol
id 1px #D6D6D6; border-collapse:separate;" />%s',$data,$matches3,PREG_SET_ORDER)
;

$photos1=$matches3[0][1];
$photos2=$matches3[1][1];
$photos3=$matches3[2][1];
$photos4=$matches3[3][1];

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DrDamnitCommented:
Use preg_match_all. preg_match stops at the first result.

http://php.net/manual/en/function.preg-match-all.php
rlb1Author Commented:
THANK YOU!!!    One follow up question...  

Is there a way to have the "40294" in this statement /40294/50/(.*?).jpg overlooked if it needs to be included to get the exact data you want off of a webpage?  

Solution worked great!!!



Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

DrDamnitCommented:
Not sure what you're asking in the follow up question. Try accepting this one, and opening a new one for that.

From what I can glean from your statement, I think that /.*/ will "overlook" it.
rlb1Author Commented:
DrDamnit:
Thank you for your help!!  Please respond to the related question I will ask in a moment.  

amit_g::
Thank you for your help!!
rlb1Author Commented:
Thank You Both!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.