I'm stuggeling with this regular expression:
preg_replace('/\/[\s\S]+?_/', '/', $currentFile)
It changes this:
/public_html/ftp/Products/1010_Air+Cooled+Condenser/productsheet_Rotary+Drum+Dryer+BR.pdf
To this: html/Air+Cooled+Condenser/Rotary+Drum+Dryer+BR.pdf
Expected result:
/public_html/ftp/Products/Air+Cooled+Condenser/Rotary+Drum+Dryer+BR.pdf
"/productsheet_" could also be "/fish-cb_" or "/appeltaartenbakker_"
"/1010_" is always a number with this length.
(?!^)\/[^\/]+_. Or(?!^)\/[^_\/]+_if you only need to remove the part after a/and before the first_in that subpart.