I know that I can replace text and leave numbers unchanged in the same match in Android studio using something like textView(\d+) in "find" field and referencing group by textView$1 but how can I increment that numbers like textView$1++? for example textView1 <anytext> textView2, textView3 and etc? not like "textView5 textView5 textView5 becomes textView6 textView6 textView6", but textView6 textView7 textView8. You can suggests other tools as well.

1

1 Answer

  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.
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy