ultraEdit正则匹配多行(xml用)

在ultraEdit中,我想选取<channel到</channel>之间的多行(进行删除)。在perl模式下,命令为"<channel[\s\S]+?</channel>"。下面是xml文件:

<!--This XML file does not appear to have any style information associated with it. The document tree is shown below.-->

<tv generator-info-name="http://epg.51zmt.top:8000" generator-info-url="QQ 31849627">

<channel id="1">
<display-name lang="zh">CCTV1</display-name>
</channel>

<channel id="2">
<display-name lang="zh">CCTV2</display-name>
</channel>

<programme start="20230917213000 +0800" stop="20230917220000 +0800" channel="591">

<title lang="zh">东方飞鹰</title>

</programme>

<programme start="20230917220000 +0800" stop="20230917230000 +0800" channel="591">

<title lang="zh">香港往事</title>

</programme>

</tv>

步骤1:ctrl+R,调出查找页面,输入查找字符"<channel[\s\S]+?</channel>"

我们将查找到第1个结果,

步骤2:

既然我们查找到了正确结果,我们可以选择"全部替换"来删除这些所有内容。

同理,我们用该命令也能查找1行内的内容,比如"<desc\s\S]+?</desc>",但是结果可能会出错,因为有<desc lang="zh"/>的时候,会匹配多行到</desc>结尾处。

二、删除多行注释

/\*[\s\S]+?\*/ 删除所有/* */,文件内容:

/*/bb0227e

123

//123

*/

<div class=\

则会匹配到

备注:

\s 空白 [ \r\t\n\f]

\S 非空白 [^ \r\t\n\f]

三、在一行内查找

还是用ultraEdit模式,正则"<desc*?</desc>"

相关推荐
PyHaVolask15 分钟前
Linux实用工具与技巧
linux·运维·chrome
qq_3813385019 分钟前
[特殊字符] MonkeyCode AI 核心功能详解
前端
万邦科技Lafite28 分钟前
淘宝关键词API接口获取分类商品信息指南
java·前端·数据库·开放api·淘宝开放平台
KevinCyao29 分钟前
教育营销短信接口开发实战:培训机构接入营销短信API实现招生信息精准触达
前端
WordPress学习笔记43 分钟前
GraceTheme定义“优雅大气”的WordPress主题新标准
前端·wordpress·wordpress主题
雨季mo浅忆1 小时前
2999第二项目梳理
前端·项目梳理
炘爚1 小时前
C++(移动构造、移动赋值、完美转发)
前端·c++
淡忘_cx1 小时前
解决 Vite EACCES 权限错误:从报错到修复的完整指南
前端·vue
We་ct1 小时前
LeetCode 191. 位1的个数:两种解法详解
前端·算法·leetcode·typescript