I have this url in a string.
$string = 'http://www.mysite.com/category/subcategory/date/12345678901234b31af3215702298964_100x100.jpg';
I need to replace characters between _
and .jpg
and put example
instead.
I have this url in a string.
$string = 'http://www.mysite.com/category/subcategory/date/12345678901234b31af3215702298964_100x100.jpg';
I need to replace characters between _
and .jpg
and put example
instead.
You could do:
$string = preg_replace('/_(.*)\.jpg/','_example.jpg',$string);