![在第一列末尾附加文本。Notepad++ 或文本文件上的宏](https://linux22.com/image/1556892/%E5%9C%A8%E7%AC%AC%E4%B8%80%E5%88%97%E6%9C%AB%E5%B0%BE%E9%99%84%E5%8A%A0%E6%96%87%E6%9C%AC%E3%80%82Notepad%2B%2B%20%E6%88%96%E6%96%87%E6%9C%AC%E6%96%87%E4%BB%B6%E4%B8%8A%E7%9A%84%E5%AE%8F.png)
我如何在 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