Notepad++ 增量替换 [英] Notepad++ incrementally replace

查看:213
本文介绍了Notepad++ 增量替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想要 10 行数据,但我想要为每一行或每条数据增加一个值.如何增加该值?

Lets say I want to have a 10 rows of data but I want a value to increment for each row or piece of data. How do I increment that value?

例如....如果我有这些行,是否有正则表达式替换 id 值以递增?

For example....If I have these rows, is there a regex way of replacing the id values to increment?

<row id="1" />
<row id="1" />
<row id="1" />
<row id="1" />
<row id="1" />

--- 这就是我想要的样子......(如果第一行的 id 上升了,那没关系)

--- Here is what I would like it to look like... (if the first row's id goes up one thats ok)

<row id="1" />
<row id="2" />
<row id="3" />
<row id="4" />
<row id="5" />

推荐答案

不确定正则表达式,但有一种方法可以让您在 Notepad++ 中执行此操作,尽管它不是很灵活.

Not sure about regex, but there is a way for you to do this in Notepad++, although it isn't very flexible.

在您提供的示例中,按住 Alt 并选择要更改的数字列.然后转到 Edit->Column Editor 并在出现的窗口中选择 Number to Insert 单选按钮.然后指定您的初始数字和增量,然后点击确定.它应该写出递增的数字.

In the example that you gave, hold Alt and select the column of numbers that you wish to change. Then go to Edit->Column Editor and select the Number to Insert radio button in the window that appears. Then specify your initial number and increment, and hit OK. It should write out the incremented numbers.

注意:这也适用于 Multi-editing 功能(选择多个位置,同时保持按下 Ctrl 键).

Note: this also works with the Multi-editing feature (selecting several locations while maintaining Ctrl key pressed).

然而,这远不及大多数人认为有用的灵活性.Notepad++ 很棒,但如果你想要一个真正强大的编辑器,可以轻松完成这样的事情,我会说使用 Vim.

This is, however, not anywhere near the flexibility that most people would find useful. Notepad++ is great, but if you want a truly powerful editor that can do things like this with ease, I'd say use Vim.

这篇关于Notepad++ 增量替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆