insert increasing number before/after specified word
- 
 I need to insert a number every time selected word appears in the document. 
 Example insert it after every “Polka:”
 like 0 , 1 , 2 , 3 etcThanks for the advice {"They":{Blob:"text",Info:{Samba:1}}}, {"me":{Blob:"text",Info:{Polka:1}}}, {"Him":{Blob:"text",Info:{Rumba:1}}}, {"She":{Blob:"text",Info:{Polka:1}}}, {"me":{Blob:"text",Info:{Polka:1}}}, {"They":{Blob:"text",Info:{Rumba:1}}}, {"me":{Blob:"text",Info:{Polka:1}}},
- 
 @SilentBronyRain , 
 You can start here.
- 
 @Lycan-Thrope said: You can start here. I think you gave the wrong link. 
 @SilentBronyRain said: I need to insert a number every time selected word appears in the document. Example insert it after every “Polka:” like 0 , 1 , 2 , 3 etc The solution to your request will need to involve scripting. You can start HERE. 
- 
 @Alan-Kilborn , 
 Of course, you’re right. I didn’t catch that it’s more than just a S/R regex in the example, but, the regex can’t hurt. :)
- 
 @SilentBronyRain said in insert increasing number before/after specified word: I need to insert a number every time selected word appears in the document. As well as a scripting option it can also be achieved with regular expressions and other built-in functions: - Insert line number at the beginning of each line
- Mark (bookmark) each line with the word Polkain it
- Cut the marked lines and paste into another tab
- Insert an increasing number at the end of each line (this can start at 0)
- move the just inserted line number (step #4) to the position behind the word Polka
- Cut/Copy these lines back into the original file, at end
- Sort the lines by using the line number inserted step #1
- Remove the line numbers
 I deliberately haven’t provided the actual commands, I will leave that for the OP to figure out. They aren’t difficult and could be a worthwhile learning experience. When inserting numbers in step #1 it’s important to tick the box “leading zeros” as otherwise sorting will not put the lines back into the original order. Note this works when only 1 “key word” is on each line. It would be possible to re-work the above process with multiple key words on each line but that would be a complicated exercise. Terry 
- 
 T Terry R referenced this topic on T Terry R referenced this topic on
