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

相关推荐
JustHappy15 分钟前
我汇总了身边朋友的经历才发现,其实第一份实习是最难找的......
前端·后端·面试
星栈27 分钟前
Dioxus 的响应式系统:`Signal`、`Memo`、`Effect` 和异步状态到底该怎么分工
前端·前端框架
yingyima28 分钟前
Java 正则表达式:比你想象的更强大
前端
yuanyxh3 小时前
macOS 应用 - 纯对话生成
前端·macos·ai编程
大家的林语冰3 小时前
ES5 凉凉,Babel 8 正式发布,默认不再编译为 ES5 和 CJS......
前端·javascript·前端工程化
光影少年5 小时前
react批量更新、同步/异步更新场景
前端·react.js·掘金·金石计划
假如让我当三天老蒯5 小时前
模块化:ES Module 与 CommonJS 的区别
前端·面试
用户40950115773175 小时前
Private Forge v2.0 发布:12大前端业务场景技能系统
前端
weedsfly6 小时前
异步编程全景与事件循环——彻底搞懂 JS 执行机制
前端·javascript
用户059540174466 小时前
AI Agent记忆测试踩坑实录:Mock骗了我一周,Mem0+pytest一招破局
前端·css