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

相关推荐
光影少年2 分钟前
说说模块化规范?CommonJS和ES Module的区别?
前端·javascript·elasticsearch
telllong28 分钟前
C++20 Modules:从入门到真香
java·前端·c++20
齐鲁大虾1 小时前
如何在HTML/JavaScript中禁用Ctrl+C
前端·javascript·html
qq_406176141 小时前
深入浅出 Vue 路由:从基础到进阶全解析
前端·javascript·vue.js
陈随易1 小时前
MoonBit访谈:MoonBit开发moonclaw实现“养虾”自由
前端·后端·程序员
汀沿河2 小时前
3 LangChain 1.0 中间件(Middleware)- after_model、after_agent
前端·中间件·langchain
紫金修道2 小时前
【OpenClaw】让openclaw根据需求创造自定义skill记录
前端·javascript·chrome
周杰伦fans2 小时前
Edge浏览器 about:blank 问题修复
前端·数据库·edge
嘉琪0012 小时前
Day6 完整学习包(async/await)——2026 0318
前端·javascript·学习