regex - 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++ 中做到这一点(或者可能是其他一些简单的方法)?
解决方案
我怎样才能在 Notepad++ 中做到这一点(或者可能是其他一些简单的方法)?
您可以在搜索模式下((\d+\.\d+\.\d+) = {...th = ")"}
将所有替换为正则表达式。\1\2"}
推荐阅读
- bash - 在 awk 中计算另一个 awk 表达式
- bash - 将单词(标签)添加到文件中
- node.js - AWS RDS / EC2:TimeoutError:Knex:获取连接超时。游泳池可能已满
- sql - 使用子查询的 Sql 查询语言
- javascript - d3 path.line stroke-width with IF 语句/三元运算符
- expression - Ocaml:乘以表达式 (*) int int -> int
- javascript - 为 Lightbox react-images 制作一个合适的 onClickThumbnail
- c++ - 我应该在哪里存储游戏的纹理?
- typescript - 如何使用 typescript 同步 eslint 或设置类似的 tslint 和 prettier?
- html - 如何在同一行对齐两个元素?