1

I have a very long MTA file for scripting MP3 tag changes.

I've edited the file numerous times in Notepad++ and this has caused the numbers for each particular action to go out of sync.

How could I use Notepad++ to find each instance of '[#number]' and replace the content incremented by one each time it finds a match, starting from the beginning of the file?

The process would have to strictly find matches like the example given to avoid other code being edited within the file.

Example screenshots

robinCTS
  • 4,407

1 Answers1

0

You cannot 'add one' with a regular expression with notepad++.

However, this workaround may work for you:

  1. Clean the numbers first: Replace \[#\d+\] by [#]
  2. Replace new lines with something that cannot be repeated inside the file: For example, replace \r\n(?!\r\n) by <<<EOL>>>
  3. Fix first line (insert the number by hand)
  4. Use column editor for the rest of the columns. Place the cursor on the second line, after the '#' and press ALT+C
  5. Select "Number to insert": Initial number => 2, Increase by => 1.
  6. Select "Leading zeros"
  7. OK => This will add the numbers
  8. Replace \[#0+(\d+)\] by [#\1]
  9. Now restore the end of lines: replace <<<EOL>>> by \r\n

Note: I'm assuming windows line ending. You may need to use \r for Mac or \n for linux.

Julio
  • 216