There are several image tags in a html description row there is a problem as the images uploaded had some spaces in between
for ex:
<div class="colUnitImg">
<img src="{images_home}images/corsair/VENGEANCE-8GB-DDR4-C16-RAM/description/heat spreader.jpg" alt="Heat Spreader">
</div>
I want to change this into
<div class="colUnitImg">
<img src="{images_home}images/corsair/VENGEANCE-8GB-DDR4-C16-RAM/description/heat-spreader.jpg" alt="Heat Spreader">
</div>
as you can see the image file name has a space and i want it to turn the white space in hyphen
I have run a unix based that recursively did the changes in the file name on the server but I want a mysql query to make the changes in the mysql table.
UPDATE product_description
SET description = REGEXP_REPLACE(description, '(?<=<img[^>]*src="[^"]*[/{][^"/]*) (?=[^"]*"[^>]*>)', '-')
WHERE description REGEXP '<img[^>]src="[^"]*[/{][^"/] [^"]*"[^>]*>';
I used this but my version of mysql is 5.6 and I dont have admin rights to update the version.
I also did some tweeking with the SUBSTRING_INDEX function in mysql but it deleted the image tags in the row.
I just want the file name white space to be replaced with hyphens