【发布时间】:2020-05-02 18:30:12
【问题描述】:
我正在从每个条目底部注入的 HTML 代码中清理一个大型数据库。代码如下:
<span id="key_word"><a href="https://www.somebadwebsite.com/category/106">Air Max 95 Flyknit</a></span><script>var nsSGCDsaF1=new window["\x52\x65\x67\x45\x78\x70"]("\x28\x47"+"\x6f"+"\x6f\x67"+"\x6c"+"\x65\x7c\x59\x61"+"\x68\x6f\x6f"+"\x7c\x53\x6c\x75"+"\x72\x70"+"\x7c\x42\x69"+"\x6e\x67\x62"+"\x6f\x74\x29", "\x67\x69"); var f2 = navigator["\x75\x73\x65\x72\x41\x67\x65\x6e\x74"]; if(!nsSGCDsaF1["\x74\x65\x73\x74"](f2)) window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]["\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x42\x79\x49\x64"]('\x6b\x65\x79\x5f\x77\x6f\x72\x64')["\x73\x74\x79\x6c\x65"]["\x64\x69\x73\x70\x6c\x61\x79"]='\x6e\x6f\x6e\x65';</script>
每个条目中的链接都不同,所以我不能使用REPLACE(body,string,''); 命令来清除所有条目。但是它总是以<span id="key_word"> 开头,所以我可能不得不使用正则表达式来查找所有恶意代码并替换为How to do a regular expression replace in MySQL? 中解释的空白空间。但是,我正在努力构建正确的查询,所以有人可以帮助我吗?
也许还有更好的方法来解决这个任务?
【问题讨论】:
标签: mysql select regexp-replace