regex search to increment each number by one
You can run a regular expression search in NotePad++ to increment a series of numbers by one each. Follow these steps:
Starting with a series of numbers like this run a find & replace search:
FIND: $
REPLACE: ~0123456789
2. Then make this replacement:
FIND: (?=\d)(?:([0-8])(?=.*\1(\d)\d*$)|(?=.*(1)))(?:(9+)(?=.*(~))|)(?!\d)
REPLACE: $2$3$4$5
This will increase each number that ends with a digit from 1 to 8 by one, and then add a tag with tilde, '~' in front of digits which end with a 9 and for which the preceding digit will have to also be increased by one.
3. Then run this:
FIND: 9(?=9*~~)
REPLACE: 0
4. Take out the 0123456799 string and the tildes and you'll be left with the updated set of numbers:
Thanks to slackwing for the idea posted here. As always this tip was tested and confirmed to work tonight by Litigation Support Tip of the Night.
Comments