08-04-2009, 06:47 AM
|
#9 (permalink)
|
|
The Acquainted
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
|
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);
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
|
|
|
|