【问题标题】:Notepad++: 2 lines search and Insert 1 if missingNotepad++:2 行搜索,如果缺失则插入 1
【发布时间】:2020-03-15 17:54:12
【问题描述】:

我在 Notepad++ 上有一个大型 XML 文档。该文档有很多这样的行:

<DowntimeReason>1</DowntimeReason> <Unscheduled>2</Unscheduled> <Active>1</Active>

但有些部分的代码复制错误,看起来像这样:

<DowntimeReason>1</DowntimeReason> <Active>1</Active>

我怎样才能找到这部分只有 2 行被复制并插入缺少的那一行?????

求救!

【问题讨论】:

  • 行的顺序总是一样吗?两者之间的缺失线是否始终显示?如果我们有&lt;DowntimeReason&gt;1&lt;/DowntimeReason&gt;\n&lt;Active&gt;1&lt;/Active&gt;\n&lt;Unscheduled&gt;2&lt;/Unscheduled&gt;怎么办?这些值是否始终相同,或者它们是任何数字或任何字符?请edit your question 并添加更多行和预期结果。

标签: xml search notepad++


【解决方案1】:

在搜索模式区域,在查找中选择“正则表达式”。

找到什么:

<DowntimeReason>1<\/DowntimeReason>\r\n<Active>1<\/Active>

替换为:

<DowntimeReason>1<\/DowntimeReason>\r\n<Unscheduled>2<\/Unscheduled>\r\n<Active>1<\/Active>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-20
    • 2020-06-19
    • 2011-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多