gpt4 book ai didi

html - MySQL 更新查询以从所有 "description"字段中删除特定的 Html 标记

转载 作者:行者123 更新时间:2023-11-28 23:30:40 25 4
gpt4 key购买 nike

我有一个 Magento 网站,其中每个产品都有一个 anchor 标记,如 <a href="link">Content</a>在他们的描述字段中。

现在我想删除这个 anchor 标记及其在标记内的内容,但保持其余描述不变。

现在的示例描述如下:

<ul>
<li>Cylinder head has been assembled to OEM specifications with using all new components like Cam shaft, valves and/or springs, buckets, shims etc. where applicable.</li>
<li>
<a href="http://sampledomain.com/media/wysiwyg/folder/file.pdf">All heads we supply pass through 24 points of quality check program.</a>
</li>
<li>Warranty: 1 year or 20,000 Kms factory warranty.</li>
<li>
<b>Kit Includes:</b>
</li>
<li>Fully assembled cylinder head</li>
<li>VRS (Vehicle regrind set)</li>
<li>Head gaskets (thickest grade)</li>
<li>Head bolts</li>
<li>Warranty card</li>
</ul>

现在我希望它显示如下:

<ul>
<li>Cylinder head has been assembled to OEM specifications with using all new components like Cam shaft, valves and/or springs, buckets, shims etc. where applicable.</li>
<li>
</li>
<li>Warranty: 1 year or 20,000 Kms factory warranty.</li>
<li>
<b>Kit Includes:</b>
</li>
<li>Fully assembled cylinder head</li>
<li>VRS (Vehicle regrind set)</li>
<li>Head gaskets (thickest grade)</li>
<li>Head bolts</li>
<li>Warranty card</li>
</ul>

如何使用更新查询执行此操作?

最佳答案

这将完成工作..!

UPDATE your_table_name  
set description =
concat
(
substring_index(description, '<a',1),
substring_index(description, '</a>',-1)
);

关于html - MySQL 更新查询以从所有 "description"字段中删除特定的 Html 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37405819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com