In general, there are two options for how you can try to do this, and both of them will depend on which editor you use. I would advise using either notepad ++ or PHPStorm, in the second case it is no longer just a text editor, but a full-fledged IDE (Integrated Development Environment). Or any other editor supporting text replacement and / or multi-cursor.
The first option is to use text replacement, for example, in notepad ++, it is called by Ctrl + H, and you can replace all the blocks in the code one by one, for example, you can change the <div class="test" title="Подсказка"><span> to <div class="test"><span> .
But in this embodiment, you will not be able to do numbering (digits after #) automatically, for example, just make a new code structure.
The second option : use a multi-cursor. You can read more about it in the case of PHPStorm here , and in the case of np ++ it is done like this:
First of all, this function needs to be activated, in the Russian version it is done along this path: Options / Settings / Edit / Multi-editing. Further, using either the text replacement function or the multicursor function itself, you modify the structure of the code, in your case I would advise using the replacement. And then do the numbering as follows. Select that piece of text, after which the increasing number should appear and press Alt + C, as a result you will see a window with two options for work, either “text to insert” or “numbers to insert”. You will need to configure everything like this:

Please note that the numbers will be inserted where you have the cursor during text selection. Then click OK and get the following text:

This is if you left the cursor to the right of #. If you leave the cursor on the left side, you will get this picture, do not mess up:
