Hello, @patrick-rozon , @peterjones , @terry-r and All,
Here is my solution. Not ideal, of course, as it would be suitable for small file size, only, but quite flexible !. It also uses a dummy character, not present in current file. I presonally chose the ¤ char of my French keyboard but, of course, any other char may be used
Add a line ¤123456 at the very end of current file
SEARCH (?s)&(.*¤)(\d)(\d+)|¤\d+
REPLACE ?1\2\1\3\2
Tick the Wrap around option
Select the Regular expression seardh mode
Hit, repeatedly, on Alt + R ( Replace button ) OR on Alt + A ( Replace All button ) till one of the follwing messages occurs :
Replace: one occurrence was replaced. No more occurrences were found.
Replae All: 0 occurrences were replaced in entire file
One advantage of this method is that you may change, either, the modudlo and the values, without changing the regex S/R ! For instance, let’s suppose you want to replace any & char, by any even number ( so, modulo 5 ), in decreasing order, Then, simply add the line ¤86420 at the very end of the file and just use the regex S/R mentionned above !
So, from the INPUT text :
------------&--------------&----&&-----------------&----------------&-----
------------&--------------&----&&-----------------&----------------&-----
------------&--------------&----&&-----------------&----------------&-----
¤86420
After 19 replaceemnts, we would get the OUTPUT text :
------------8--------------6----42-----------------0----------------8-----
------------6--------------4----20-----------------8----------------6-----
------------4--------------2----08-----------------6----------------4-----
Best Regards,
guy038