使用Regex从SQL文件中删除带有某些变量的字符串的所有实例

问题描述

我有一个sql文件,其中包含使用Visual Composer创建的wordpress帖子。我面临的挑战是,为了删除特定元素的所有实例,我需要搜索和替换它,但是每个元素都有其自己的ID,因此该ID将是一个变量,因此我的想法是使用通配符每个ID,但我似乎无法获取。这是我要删除的所有实例的元素:

<item android:id="@+id/share_btn" android:title="" .../>

您会注意到,“ vc_custom”的每个实例旁边都有一个星号,但这似乎不能用作通配符吗?

这是我用于正则表达式搜索内容

[vc_row full_width=\"stretch_row_content\" css=\".vc_custom_*{margin-top: 0px !important;margin-bottom: 0px !important;}\" el_id=\"footer-tabs-gold\"][vc_column][/vc_column][/vc_row][vc_row full_width=\"stretch_row\" el_id=\"footer-info-02\" css=\".vc_custom_*{margin-top: 0px !important;margin-right: 12px !important;margin-bottom: 0px !important;margin-left: 12px !important;background-color: #404040 !important;}\"][vc_column width=\"1/4\" css=\".vc_custom_*{padding-right: 7px !important;padding-left: 7px !important;}\"][vc_column_text css=\".vc_custom_*{padding-top: 10px !important;padding-right: 7px !important;padding-bottom: 10px !important;padding-left: 7px !important;}\"][includeme file=\"art_external/footer-sub3-col1.htm\"][/vc_column_text][/vc_column][vc_column width=\"1/4\" css=\".vc_custom_*{padding-right: 7px !important;padding-left: 7px !important;}\"][vc_column_text css=\".vc_custom_*{padding-top: 10px !important;padding-right: 7px !important;padding-bottom: 10px !important;padding-left: 7px !important;}\"][includeme file=\"art_external/footer-sub3-col2.htm\"][/vc_column_text][/vc_column][vc_column width=\"1/4\" css=\".vc_custom_*{padding-right: 7px !important;padding-left: 7px !important;}\"][vc_column_text css=\".vc_custom_*{padding-top: 10px !important;padding-right: 7px !important;padding-bottom: 10px !important;padding-left: 7px !important;}\"][includeme file=\"art_external/footer-sub3-col3.htm\"][/vc_column_text][/vc_column][vc_column width=\"1/4\" css=\".vc_custom_*{padding-right: 7px !important;padding-left: 7px !important;}\"][vc_column_text][includeme file=\"art_external/footer-sub3-col4.htm\"][/vc_column_text][/vc_column][/vc_row][vc_row full_width=\"stretch_row_content\" el_id=\"footer-tabs\" css=\".vc_custom_*{background-color: #404040 !important;}\"][vc_column][/vc_column][/vc_row]

实际上,这确实找到了所有实例,这是我最接近解决方案的实例,但是,它不会删除complete元素。甚至可能有更简单的方法,所以也欢迎使用任何其他解决方案。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)