View Single Post
Old 08-04-2009, 06:47 AM   #9 (permalink)
JaoudeStudios
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

I have not tested the below, so it probably wont work, but it will give you a rough idea. Best thing to do is to find an online regex maker - it will allow you to paste some code in and then write your regex and it will match live as you type. ie. http://gskinner.com/RegExr/

PHP Code:
$pattern '@[a-zA-Z0-9_.-]*<img[a-zA-Z0-9_.-]*src="http://www.[a-zA-Z0-9_.-]*"[a-zA-Z0-9_.-]*/>@i';
$subject '<div id="images"><img src="http://www.jaoudestudios.com/images/image1.jpg" alt="This is an image" /></div>';
preg_match($pattern$subject$matches); 
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!

Last edited by codefreek : 08-04-2009 at 12:53 PM. Reason: PHP tags added - please read http://www.talkphp.com/lounge/4563-prettifying-pasted-code-talkphp.html
JaoudeStudios is offline  
Reply With Quote