ChatGPT解决这个技术问题 Extra ChatGPT

Notepad++ add number in each line

I have the following data in a text file

p=1
p=1
p=1
p=1

etc. I open that file in Notepad++.

How would I change it to

p=1
p=2
p=3
p=4

etc.

I guess I understand what you mean but I don't think it's a job for regex. You would better use a script for doing this kind of replacement.

d
darthbith

You can use the "Column Editor" mode. First, select the column you want by holding Alt and dragging down the column. Then go to "Edit->Column Editor", you will get a box that looks like this:

https://i.stack.imgur.com/7qfW6.png

Choose the "Number to Insert" button, then choose the starting value and the increment. It will replace the column with the values you want.


For keyboardists column selection is done with Shift + Alt + arrow keys. You can select a zero width column to insert data, e.g. numbering a list. notepad-plus-plus.org/features/column-mode-editing.html
And, at least as of Notepad++ 7.5.9, you can bring up the Column Editor pop up with Alt-C.
This pads to the right of the numbers to match right shift of larger numbers. I used an online script instead.
Do you why this doesn't work for me? Maybe I select wrongly?
Leave the repeat text input box for latest notepad++ versions ..