79656032

Date: 2025-06-06 14:03:20
Score: 0.5
Natty:
Report link

For the benefit of future readers:-

@Toto's answer may replace other numbers as well, so I am posting another PythonScript here to match <sup>, followed by a [ bracket and then the number sought as per the question. You can run a python script within the PythonScript plugin of Notepad++ for that.

If it is not yet installed, install it via Plugins Admin. To install the PythonScript plugin in Notepad++, navigate to Plugins > Plugins Admin. Check the box next to PythonScript and click Install. Notepad++ will restart, and after that, you can find the plugin in the Plugins menu.


# encoding=utf-8
from Npp import *

def custom_replace_func(m):
    new_text = "<sup>\[{}".format(custom_replace_func.counter)
    custom_replace_func.counter += custom_replace_func.increment
    return new_text

custom_replace_func.counter = 1  # starting value
custom_replace_func.increment = 1
editor.rereplace(r'<sup>\[(\d+)', custom_replace_func)
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Toto's
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: dr rao