You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Notepad++正则批量移除Impyrion配置文件Mass数值最后一位

Notepad++正则批量修改Impyrion配置文件Mass数值方案

需求说明

批量修改Impyrion Galactic Survival的.yaml/.ecf配置文件,移除所有Mass: 相关行(包括行首带#注释、行前有缩进的)中数值的最后一位,不管该行后面有没有注释或其他逗号分隔的属性。

具体操作步骤

  1. 打开Notepad++,导入需要修改的配置文件(支持批量打开多个)
  2. 按Ctrl+H调出替换窗口
  3. 切换到「正则表达式」模式,勾选「匹配大小写」(配置里是大写M的Mass),不要勾选「.匹配换行符」
  4. 「查找目标」填入:
(#?\s*Mass:\s*)(\d+)(\d)(?=[^0-9]|$)
  1. 「替换为」填入:
\1\2
  1. 点击「全部替换」,所有符合要求的Mass数值都会自动去掉最后一位

正则逻辑简单说明

  • #?\s*Mass:\s*:精准匹配各种格式的Mass行头,包括带#注释的、前面有空格缩进的情况
  • (\d+)(\d):把Mass后的数字拆成两部分,前面的所有有效数字,加上最后一位要删掉的数字
  • (?=[^0-9]|$):确保只删数值的最后一位,不会误删后面其他数字(如果有的话)

效果验证

原输入片段:

Mass: 1386, type: float, display: true, formatter: Kilogram    # should be dynamic
  Volume: 99, type: float, display: true, formatter: Liter
  Mass: 6909    #All comments are preceded by a "#" in the game config files.
#Mass: 5000    #Using a "#" at the beginning of a line comments the entire line.
Mass: 900

修改后结果:

Mass: 138, type: float, display: true, formatter: Kilogram    # should be dynamic
  Volume: 99, type: float, display: true, formatter: Liter
  Mass: 690    #All comments are preceded by a "#" in the game config files.
#Mass: 500    #Using a "#" at the beginning of a line comments the entire line.
Mass: 90

内容的提问来源于stack exchange,提问作者Alexandria

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 11:15:47