How do I structure this Regex?


I am new to Regex.  

What Regex would I use to get the result of only:

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);


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" 
					       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 href="hires-image-viewer.asp?sku=40294&image=1" 
					       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 href="hires-image-viewer.asp?sku=40294&image=2" 
					       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 href="hires-image-viewer.asp?sku=40294&image=3" 
					       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;" />

Open in new window

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.

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)


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
Use preg_match_all. preg_match stops at the first result.
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.

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:
Thank you for your help!!  Please respond to the related question I will ask in a moment.  

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.