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

相关推荐
阳光是sunny1 分钟前
Vue 项目怎么做用户行为全链路监控?轻量插件方案详解
前端·面试·架构
ZhengEnCi12 分钟前
Q04-Vite禁用CSS代码分割-解决生产环境样式加载顺序混乱问题
前端·vue.js·vite
九酒43 分钟前
AI Agent 开发踩坑记:口播功能非得用 APP 原生实现吗?
前端·人工智能·agent
Jackson__1 小时前
做了一段时间的AI coding后,我终于搞清了 CLI 和 MCP 的区别
前端·agent·ai编程
IT_陈寒4 小时前
JavaScript项目实战经验分享
前端·人工智能·后端
用户47949283569155 小时前
6w star,GitHub 趋势第一的 Ponytail,这个agent插件到底在火什么
前端·后端
薛定喵的谔6 小时前
我开源了一个精致的 Next.js 博客模板:Skyplume
前端·前端框架·next.js
张龙6877 小时前
构建生产级 AI Agent:工具调用与记忆架构实战指南
前端
kyriewen8 小时前
2026 年了,还在用 Node.js?Bun 迁移实战:20 分钟搞定,附踩坑记录
前端·javascript·node.js
青山Coding9 小时前
Cesium应用(八):物体运动的实现思路
前端·cesium