I am very new to regular expressions and I need help. First, I will explain my motivation and some diagrams, as it is difficult to explain otherwise.
I recently installed a Vim Indent guide that displays these vertical stripes / rulers like this (image from github account):

The way this is done is to match patterns at the beginning of the line and add them to IndentGuidesEven or IndentGuidesOdd . The problem is that it cannot match empty strings and you get less than perfect hilighting, for example: 
The easiest solution is to delete all empty / empty lines, but code without spaces can be hard to read. I meant converting the code in several steps and, ultimately, adding spaces, as shown below.

What am I doing:
- removing spaces from all lines only with spaces
%s/\s\+$//e - truncation of all several empty lines
%s/\n\{3,}/\r\r/e - adding spaces to empty lines
%s/^\ \(\ *\)\([^\ ]\)\(.*\)\n^\ *$\n^\ /\ \1\2\3\r\ \1\r\ /gc
what this last statement does is three lines where the first and third are non-empty and the second is empty. But this leads to problems if the first line, for example, is indented 8 times, and the third is only indented 3 times. In any case, finding the first pattern (in this case, 8 indents) to use it in the same search pattern, so that lines 1 and 3 start with the same number of spaces? I’m sure that I can do it with an iterative function, and start, for example, with 30 indentation and go back, but it can be a little inefficient.
I know that lines with only spaces are bad. However, removing spaces is trivial, and I have a key made for this automatically. If necessary, I can quickly remove them. In addition, I know that the problem is more complicated than this, and there are more cases to consider, however, I will deal with those cases as they represent themselves.
Any tips on how I can do this?