I have following image url:
http://www.example.org/wp-content/blogs.dir/29/files/2013/02/Personalized-Results-Asterisk-600x417.png
Here url con
Try this :
$string = 'http://www.example.org/wp-content/blogs.dir/29/files/2013/02/Personalized-Results-Asterisk-600x417.png'; $pattern = '/\-*(\d+)x(\d+)\.(.*)$/'; $replacement = '.$3'; echo preg_replace($pattern, $replacement, $string);