How to bulk remove image links from posts?

Question

I’ve just migrated my blogspot to worpress with own domain but, images link to blogspot site.

I found I could replace the code with a regex plugin: Search Regex and tried with this regex:

/<a ([sS]*?) href="(https|http)://[1-9].bp.blogspot.com([sS]*?)>([sS]*?)</a>/

But when trying to replace with $1 or $3 it deletes the image tag.

Code is like
I would like to leave only the tag as is.

Result Ex using the regex and plugin:

...yle="clear: both; text-align: center;"> <a href="https://1.bp.blogspot.com/-dPFeTMuUXXo/Xknrkn484UI/AAAAAAAB3bY/UaIBR-0nZt48fTP84HSiiyGt6mq4rqEsQCLcBGAsYHQ/s1600/Dragon%2BMother%2Bof%2BDragons%2BGame%2Bof%2BThrones.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="820" data-original-width="1000" height="327" src="https://www.wptricks.com/wp-content/uploads/2020/04/Dragon2BMother2Bof2BDragons2BGame2Bof2BThrones.jpg" width="400" /></a></div> <br /> <div class="separator" style="clear: both; text-align: center;"> <a href="https://1.bp.blogspot.com/-OUiWJAEJMoU/Xknrtd9SDuI/AAAAAAAB3bc/2navlhlW0Lk0GC1RolrWz37zfCiP-XP-QCLcBGAsYHQ/s1600/Three%2BEyed%2BRaven%2BPopup.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1000" height="400" src="https://www.wptricks.com/wp-content/uploads/2020/04/Three2BEyed2BRaven2BPopup.jpg" width="400" /></a></div> <br /> <div class="separator" style="clear: both; text-align: center;"> 

It is replaced with:

… yle="clear: both; text-align: center;"> /-OUiWJAEJMoU/Xknrtd9SDuI/AAAAAAAB3bc/2navlhlW0Lk0GC1RolrWz37zfCiP-XP-QCLcBGAsYHQ/s1600/Three%2BEyed%2BRaven%2BPopup.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"</div> <br /> <div class="separator" style="clear: both; text-align: center;">

So it replaced two images code and left only a part of the second, but this should leave the first

Based on: Remove all links to a specific website

0
, , Andrea Ugalde 3 years 2020-04-07T12:51:48-05:00 0 Answers 97 views 0

Leave an answer

Browse
Browse