replacement within a string

I have a string that could be up to 8000 characters.
String is a text with pictures and stuff like that.
How can I do a replace on the string to cut out everything that is an email, I mean that looks like this:
http://someurl/folder/anotherfolder/whatever/name.jpg
or
http://someurl/folder/anotherfolder/whatever/name.gif

Pretty much I want to remove all the pics from the $string.
I guess it would be preg_replace with regexp?
But I have no clue how to do this. Please someone help.
LVL 1
sushestvoAsked:
Who is Participating?
 
RoonaanCommented:
That's fairly easy:

$preg = '#http://(.*)\.(jpg|jpeg|gif|png)#i';

-r-
0
 
RoonaanCommented:
$preg = '#http://[\w/\.]+#i';
$replace = '';
$string = preg_replace($preg, $replace, $string);

-r-
0
 
sushestvoAuthor Commented:
it doesn't really work... especially with multiple pics on in the $string
or even with this (http://images.ciao.com/ide/images/products/normal/784/product-102784.jpg)
it leaves "-102784.jpg" behind.
Is it possible to cut out everything between http and jpg ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.