我刚学会了如何根据标题中的特定关键字删除帖子,以便用MySQL执行。现在我正在尝试学习如何执行类似的脚本来搜索帖子内容并删除以下HTML代码:
<input id="website_url" class="c7" type="text" value="this text changes" />
值本身会发生变化,但只要脚本删除包含的所有内容,直到/&gt;它会起作用。
这是我之前关于帖子标题的用法
DELETE FROM wp_posts WHERE post_title REGEXP '\\1970-01-01 01:00:00'
我知道上面没有相关性,但我输入的关于我想要删除的内容是我为之奋斗的地方
答案 0 :(得分:0)
我建议:
select * from toy;
with key(string1) as (select '<input id="website_url" class="c7" type="text" value="')
update toy set html =
( select
substr(html,0,instr(html, (select string1 from key)))
||
substr(substr(html,4+instr(html, (select string1 from key))),
instr(substr(html,instr(html, (select string1 from key))), '" />' )
)
)
where html like '%'||(select string1 from key)||'%';
基本上
where html like '%'||(select string1 from key)||'%';
update ... set html = ...||...
with key(string1) as (select '...')
- &gt; (select string1 from key)
instr(...)
,substr(...)
4+