63 posts
  • Bought between 1 and 9 items
  • Has been a member for 2-3 years
mattmatt88 says

Hello

I’ve got lot of different image URLs like these

http://mypage.co.uk/images/2012/4123hu480._BO2,204,203,200.jpg
http://mypage.com/fav9hu3.9033,210,200.jpg

I need to change them (I think with preg_replace), so that the content between the last two dots disappears.

So the links should be:

http://mypage.co.uk/images/2012/4123hu480.jpg
http://mypage.com/fav9hu3.jpg

Note that there might be other dots in the URL. Only the content between the last two dots should be cleared.

Can you help me with that?

158 posts
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 50 and 99 users
  • Sold between 1 000 and 5 000 dollars
  • United States
greenshady says

I’m thinking you’d need a pattern along these lines (completely untested):

#(http?://.+/.+)(\..+?)(.jpg|.png|.gif)$#i
63 posts
  • Bought between 1 and 9 items
  • Has been a member for 2-3 years
mattmatt88 says

That worked very well. Although I will never understand these kind of codes ^^

Thanks a lot

by
by
by
by
by
by