How can I increment numbers on every match in Notepad++ Python Script or Android Studio?

  1. With Notepad++, install Python Script plugin.
  2. Go to Plugins -> Python Script -> New Script.
  3. Enter the code below. Save it.
    import re
    
    counter = 0
    def calculate(match):
        global counter
        counter += 1
        number = int(match.group(0)) + counter  
        return str(number)
    
    editor.rereplace('(?<=textView)(5)', calculate)
    
  4. Open the file you want to edit.
  5. Go to Plugins -> Python Script -> Scripts, select the script you created and saved.