0

This is my first question, so pardon me the ethics the first time. I am running a wordpress website., and I need to remove strings from all posts.

The string to be removed <li class="dZip">(combination of characters, even special)Download ZIP</a></li>

It varies according to the post. I could use a plugin, But plugins don't accept wildcards.

I tried running this in my phpmyadmin, but I don't see any result.,

This is the query I ran through phpmyadmin.

SELECT REGEXP_REPLACE(`post_content`,'<ul class="md_wholebook_list"><li class="dZip"><a href="(.*?)\.zip" title="(.*?)\.zip" download>Download ZIP</a></li></ul>','')

Example string :

<ul class="md_wholebook_list"><li class="dZip"><a href="https://example.com/demo/file.zip" title="file.zip" download>Download ZIP</a></li></ul>

I need to remove this whole string, with the link and filetile as varying strings.

1 Answers1

0

It is quite simple.

But make a BACKUP before doing this Update on your database

SELECT REGEXP_REPLACE('a<ul class="md_wholebook_list"><li class="dZip"><a href="https://example.com/demo/file.zip" title="file.zip" download>Download ZIP</a></li></ul>b',
'<ul class="md_wholebook_list"><li class="dZip">(.*)download>Download ZIP</a></li></ul>','');
SELECT REGEXP_REPLACE('a<ul class="md_wholebook_list"><li class="dZip"><a href="https://example.com/demo/file.zip" title="file.zip" download>Download ZIP</a></li></ul>b',
'<ul class="md_wholebook_list"><li class="dZip">(.*)download>Download ZIP</a></li></ul>','');
| REGEXP_REPLACE('a<ul class="md_wholebook_list"><li class="dZip"><a href="https://example.com/demo/file.zip" title="file.zip" download>Download ZIP</a></li></ul>b',
'<ul class="md_wholebook_list"><li class="dZip">(.*)download>Download ZIP</a></li></ul>','' |
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ab                                                                                                                                                                                                                                                              |

db<>fiddle here

nbk
  • 45,398
  • 8
  • 30
  • 47