I understand that you need to remove all the numeric values between second and third last slashes. Since this appears like a one-off exercise, I would recommend doing this directly on the database (once tested on local db)
You would need to use REPLACE method in the query and target the unwanted numeric values by obtaining them using SUBSTRING_INDEX.
The UPDATE Query:
UPDATE images SET title = REPLACE(title, concat(substring_index(substring_index(title, "/", -2), "/", 1), "/"), "")
Assuming the table name is images. Alter as required
Assuming the filed name is title. Alter as required
"SET" allows you to update the field
"REPLACE" allows you to replace the string (REF. https://www.w3resource.com/mysql/string-functions/mysql-replace-function.php)
"concat" allows you to join the target numeric string with a slash in the end
"SUBSTRING_INDEX" allows you to split the value using a delimiter and in this case the "/".
Worth adding a where clause to run the update query only on few records to begin with.
NOTE: Please run a select query prior to running an update to see if you have grabbed the correct string.
EG.
SELECT title as title_before, substring_index(substring_index(title, "/", -2), "/", 1) as string_to_be_replaced, REPLACE(title, concat(substring_index(substring_index(title, "/", -2), "/", 1), "/"), "") as title_after FROM images
IF you notice the title_after is the correct one, then proceed to run the update query
a) on your local db using WHERE clause to limit the updates to few records.
b) running it then on the production after taking a backup of the table.
Hope this helps.