Replace string across multiple files and increment valuebrowsing

I’m looking for an urgent solution! We need to append a text string in 1800+ XML files and increment the value by 1. Alternatively, I could append the text string with the filename of the doc. Either solution would work.

Example 1
Original string is Benjamin_poster.jpg across all files
New value would be Benjamin_poster1.jpg, Benjamin_poster2.jpg etc.

OR

Example 2
Original string is Benjamin_poster.jpg across all files
New value would be Benjamin_poster[filename1].jpg, Benjamin_poster[filename2].jpg etc.

Oh, many thanks for your offer, but I could had help you, for free , just for the pleasure to give you a decent solution ;-))

Unfortunately, this kind of search / replacement can’t be easily achieved, even with the powerful regular expression engine,included in N++, because it needs some calculus, based on the + operation !

But, don’t be sad ! This task should be easily run, in few lines of code, with a Python or Lua script, which can be performed, from inside Notepad++ ! However, up to now, I’m, personally, still unable to create such scripts !

Few questions:
Is there only one occurrence of the search string in each file or could it be multiple?
If there are multiple search strings in one file should all be replaced with same value
or should it be already incremented?
If only each file should get the incremented value, what if a file doesn’t have the search string,
can this incremented value be discarded or is it needed to assign it to the next file. Something like

file1 has the search string and will be replace with new_value1
file2 has the search string and will be replace with new_value2
file3 has not the search string
file4 has the search string and will be replaced with value (3 or 4)?