I'm not aware of any way to generate a sequence of numbers using Regex.

I've been considering providing a tool or search option that allows this, for chapters and endnotes, so I'll put it on the Issues log as a request. It would probably be fairly simple though. Prompt you for a starting number and text to replace (e.g. "SEQUENCE#" or whatever text you type). Then it would just start from the first file and replace each occurrence with the number then increment, or possibly start from where you are in Code View to the end (no wrapping). You would have to convert all the text needing numbers to use "SEQUENCE#" or similar first - and in your case, run this twice since you use the number twice. I'd probably add Roman numerals as an option as well.

Thanks very much for the reply. The enhancement that you're thinking about sounds great.

It seems similar to the way the file remaming function presently works, so I'm wondering if we could pass a number in the file name via a storable variable into an id, or if the id generator can have an option to replace numbers in sequence in selected files?

This is how I used the TOC generator to get around the regex limitation in the first place, so it might be easier to let us configure sigil_toc_# in preferences -- to either emulate the behavior found in version 7.0 or 6.2. You have the old code so branching logic may save the time and effort of developing something new.

If, however, you decide to develop a new tool, I have some thought on that too, so please let me know if I can be of service.

Math/Science Module: Generally, you can't do math functions in regex, so a module for that would be very helpful for technical writers. Right now, cut & paste from an external program is your best option, but not every program will let you save in appropriate html format, so clean-up can be difficult and time-consuming.

File Naming: Give us the option to add both prefix and suffix numbers independently, ideally in one pass, but at least in two. I'm thinking of a file name sequence such as:
00_Title_Page.xhtml
01_Part1.xhtml
02_Chapter_1.xhtml
03_Chapter_2.xhtml

Also give us the ability to pass the existing file name or wild cards in the file name generator. A storable variable could do the trick for the naming features.

As always, I greatly appreciate your team's willingness and effort to constantly refine Sigil. You do such a great job!