I've got a text file, containing following lines
<a href="tg://proxy?server=radan.rooznameh.etellaate.rooz.romatism.sbs&port=443&secret=ee32b920dffb51643028e2f6b878d4eac175706c6f6164626f792e636f6d&bot=@mtpro_xyz_bot#ES">1<p> </a>
<a href="tg://proxy?server=digkala-com-heneri-com.1400.melbourne&port=443&secret=ee000000000000000000000000000000006b65746161626f6e6c696e652e636f6d&bot=@mtpro_xyz_bot#IE">2<p> </a>
<a href="tg://proxy?server=103.105.48.76&port=443&secret=eefacacf88a07e73d961d7029c1da7e64b64756f6c696e676f2e636f6d&bot=@mtpro_xyz_bot#GB">3<p> </a>
...
<a href="tg://proxy?server=5.28.193.20&port=443&secret=eed41d8cd98f00b204e9800998ecf8322e7777772e676f6f676c652e636f6d&bot=@mtpro_xyz_bot#DE">1315<p> </a>
I want to replace all ...>1<p>
, ...>2<p>
, ... near line ends with server addresses.
The text above should become
<a href="tg://proxy?server=radan.rooznameh.etellaate.rooz.romatism.sbs&port=443&secret=ee32b920dffb51643028e2f6b878d4eac175706c6f6164626f792e636f6d&bot=@mtpro_xyz_bot#ES">radan.rooznameh.etellaate.rooz.romatism.sbs<p> </a>
<a href="tg://proxy?server=digkala-com-heneri-com.1400.melbourne&port=443&secret=ee000000000000000000000000000000006b65746161626f6e6c696e652e636f6d&bot=@mtpro_xyz_bot#IE">digkala-com-heneri-com.1400.melbourne<p> </a>
<a href="tg://proxy?server=103.105.48.76&port=443&secret=eefacacf88a07e73d961d7029c1da7e64b64756f6c696e676f2e636f6d&bot=@mtpro_xyz_bot#GB">103.105.48.76<p> </a>
...
<a href="tg://proxy?server=5.28.193.20&port=443&secret=eed41d8cd98f00b204e9800998ecf8322e7777772e676f6f676c652e636f6d&bot=@mtpro_xyz_bot#DE">5.28.193.20<p> </a>
Please, scroll right to see the difference.
In other words, being opened in a browser, this file is rendered as a list of numbers, each of which is a link to the Telegram proxy. I want to replace these numbers with server addresses to make it look more pleasant.
I guess, g
command can do the job, however, I don't know how to access matched group or matched pattern.
I've tried many variants, and the best is
:g/server=\(.*\)&/y a|s#>\[0-9\]\+<#\=getreg('a')#
It does not work, because y a
command yanks the whole line while I need only part of it. And numbers in subsequent s
command are not matched.
Is there any way to do it from the :
line, without writing additional functions?
I understand that this task can be easily done with awk + sed, however, I think this is not sportive :)
:%!sed ...
:)<p>
tag without closing</p>
within the<a></a>
? This does not look like clean HTML.