Hello,

I’m tryng to make some replacements on a string.

Everything goês fine until the regular expression.

 

$file = "screens/temp/7a45gfdi6icpan1jtb1j99o925_1_main.jpg";

echo $a =  str_replace(array(7a45gfdi6icpan1jtb1j99o925,
'temp/',’_([0-9])’), array(“test”,"",””), $file)

 

The idea is to remove /temp and the last _1 from the file name..but i’m only
getting this:

screens/test_1_main.jpg

 

I want it to be: screens/test_main.jpg

 

Thank you

 

Reply via email to