首页 > 解决方案 > Notepad++ - 如何将行首的数字批量复制到每行的另一部分?

问题描述

所以我正在寻找一种更快的方法来大规模重新格式化游戏的一些文件。

我有这样的代码:

84045 = {
    name = Sam
    dynasty = 3
    dna = kfsdiofjsoidfj
    culture = example
    religion = example
    martial = 10
    diplomacy = 10
    stewardship = 10
    intrigue = 10
    learning = 10
    add_trait = trait
    add_trait = trait
    add_trait = trait

    father = 84042
    1395.6.7 = {birth = ""}
    1449.6.7 = {death = ""}
}

我需要的与这部分有关:

    1395.6.7 = {birth = ""}
    1449.6.7 = {death = ""}

所以我有数百个这样的条目。我想要的是像“1395.6.7”这样的数字被大量复制并输入引号,结果如下:

    1395.6.7 = {birth = "1395.6.7"}
    1449.6.7 = {death = "1449.6.7"}

我怎样才能在 Notepad++ 中做到这一点(或者可能是其他一些简单的方法)?

标签: regexreplacecopynotepad++

解决方案


我怎样才能在 Notepad++ 中做到这一点(或者可能是其他一些简单的方法)?

您可以在搜索模式下((\d+\.\d+\.\d+) = {...th = ")"}将所有替换为正则表达式\1\2"}


推荐阅读