You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defadd_1(m):
z=int(m.group(1))
return'Y'+str(z+1) ifz<100elsem.group(0)
# replace X followed by numbers by an incremented number# e.g. X999# e.g. X56 X39# e.g. X999# e.g. X56 X39# e.g. X999# e.g. X56 X39# becomes# Y57 Y40 Y1000editor.rereplace('X([0-9]+)', add_1);
Running this script upon its own source file tab results in:
Note that lines 7, 9, 11 have the change-history modified marker, even though the text on this lines is the same as it was before the script was run and the replacements made.
Ideally the text that isn't changed wouldn't be replaced and the result after the replacement would look like this: