简体   繁体   English

移除所有<div>带有查询的标签</div><div id="text_translate"><p>我想从内容中删除所有<div>标签,我使用此查询,它只删除没有 class 的<div>标签,如何删除所有<div>,<div class"example">,</div> ?</p><pre> UPDATE wp_posts SET `post_content` = REPLACE (`post_content`, '<div>', '') WHERE `ID`=84259</pre><p> 我想要一个删除<%div%>的查询(% 意味着不管 div 之前和之后是什么)</p></div>

[英]Remove all <div> tags with a query

I want to remove all <div> tags from content, I use this query and it removes only <div> tags with no class, how to remove all <div>,<div class"example">,</div> ?我想从内容中删除所有<div>标签,我使用此查询,它只删除没有 class 的<div>标签,如何删除所有<div>,<div class"example">,</div>

UPDATE wp_posts SET `post_content` = REPLACE (`post_content`, '<div>', '') WHERE `ID`=84259

I want a query that removes <%div%> (% means no mater what is before and after div)我想要一个删除<%div%>的查询(% 意味着不管 div 之前和之后是什么)

You can use REGEXP_REPLACE :您可以使用REGEXP_REPLACE

update wp_posts
set post_content = REGEXP_REPLACE(post_content, '</?div.*?>', '');

Fiddle 小提琴

移除所有<div tags with sql query< div><div id="text_translate"><p> 我有表名wp_posts并且在post_content列中有我的帖子的描述(HTML 格式)。</p><p> 我想要一个在 post_content 列中搜索并选择以<div class or no class>开头的标签并删除整个标签的查询。</p><p> 我不想删除标签内的任何内容,只需删除标签</p><p>这个:</p><pre> <div> or <div clas="sada"> some text </div></pre><p> 会变成这样:</p><pre> some text</pre><p> 我的 MYSQL 版本是 15.1。</p></div></div> - Remove all <div tags with SQL Query

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 移除所有<div tags with sql query< div><div id="text_translate"><p> 我有表名wp_posts并且在post_content列中有我的帖子的描述(HTML 格式)。</p><p> 我想要一个在 post_content 列中搜索并选择以<div class or no class>开头的标签并删除整个标签的查询。</p><p> 我不想删除标签内的任何内容,只需删除标签</p><p>这个:</p><pre> <div> or <div clas="sada"> some text </div></pre><p> 会变成这样:</p><pre> some text</pre><p> 我的 MYSQL 版本是 15.1。</p></div></div> - Remove all <div tags with SQL Query 删除除div类外的所有html标签和内容 - Remove all html tags and content except for a div class 从字符串php正则表达式中删除所有div标签? - Remove all div tags from string php regex? 如何根据DIV标签中的关键字删除所有URL - How to remove all URLs based on keywords in the DIV tags MY SQL查询,用于从字段中删除所有标签 - MY SQL Query for remove all a tags from field 如何删除所有标签? - How to remove all tags? 如何从内部删除标签 <div> 标签 - How to remove <b> tags from inside the <div> tags 正则表达式删除div标签,但不删除其内容 - Regex to remove div tags but not their content 在存储标签之前删除所有标签 - Remove all tags before store tags 如何删除所有div标签,而不删除其内容? (使用contenteditable =“ true”,HTML5) - How to remove all div tags, but not content, which it have? (Working with contenteditable=“true”, HTML5)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM