在第一列末尾附加文本。Notepad++ 或文本文件上的宏

在第一列末尾附加文本。Notepad++ 或文本文件上的宏

我如何在 Notepad++ 中执行此操作?仅在第一列添加 .USA ?

AABA,D,20180323,74.98,75.75,72.67,73,5051300
AAL,D,20180323,52.63,53.1,50.99,51.01,3966000
AAME,D,20180323,3.13,3.25,3.1,3.25,1100

结果:

AABA.USA,D,20180323,74.98,75.75,72.67,73,5051300
AAL.USA,D,20180323,52.63,53.1,50.99,51.01,3966000
AAME.USA,D,20180323,3.13,3.25,3.1,3.25,1100

答案1

Notepad++ 不理解后视,\K所以您必须使用它。

  • Ctrl+H
  • 找什么:^[^,]+\K
  • 用。。。来代替:.USA
  • 检查环绕
  • 检查正则表达式
  • Replace all

解释:

^       : beginning of line
[^,]+   : 1 or more any character that is not a comma
\K      : forget all we have seen until this position

给定示例的结果:

AABA.USA,D,20180323,74.98,75.75,72.67,73,5051300
AAL.USA,D,20180323,52.63,53.1,50.99,51.01,3966000
AAME.USA,D,20180323,3.13,3.25,3.1,3.25,1100

相关内容