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>"

相关推荐
量化分析码农24 分钟前
【Python量化多因子实战 04】因子暴露不是 alpha:市值与行业中性化实战
前端·后端
不可能片场1 小时前
Electron 发布 正文写入的三条通道与读回口径
前端·electron
jerrywus1 小时前
让 AI 帮你部署 Vercel,报错了也不用手动搬日志
前端·agent·mcp
补码缩写1 小时前
11 行 Python 拆 PNG 块,解压后的字节数能手算
前端
coding漫漫长路1 小时前
PNG压缩先看图是哪一类,先无损再量化多半白做
前端
用户257680763211 小时前
搜「洗牙」为什么搜不到「洁治」
前端
费曼学习法1 小时前
Agent 死循环的根因不在模型:错误分类、退避、熔断、快照四层实现
前端
修炼的dance1 小时前
同一张PNG换五种压法,体积差在颜色数上
前端
Lank_M1 小时前
PNG 有损压缩省下的体积,大头不在 deflate
前端
用户老李2 小时前
相机模型与标定自学教程 02:外参 \[R | t] 与完整投影链路
前端