<?php $string="localhost/uploads/images/photo.jpg"; $string2="localhost/uploads/images/photo_thumb.jpg"; $replacement="$1/$2_thumb.$3"; $pattern= '/([\w+\/]*)(?=\/)\/([\w]+(?<!_thumb))\.(\w+)/i'; echo preg_replace($pattern, $replacement, $string); echo "\n\r"; echo preg_replace($pattern, $replacement, $string2);
You have javascript disabled. You will not be able to edit any code.