I am trying to format a list that uses tabs for indentation so it will render as a bulleted list on Confluence. That means that each instance of a tab needs to be replaced with an asterisk (*), plus one leading asterisk, and then a space at the end of the string of asterisks.
Example:
Level 1
\tLevel 2
\tLevel 2
\t\tLevel 3
\tLevel 2
Level 1
Would become:
* Level 1
** Level 2
** Level 2
*** Level 3
** Level 2
* Level 1
I have tried doing a global replace (s/\t/\*/g
) and then adding an asterisk at the beginning of each line, but that leaves me without the trailing space. I also tried the \ze atom as detailed here (s/\*\ze/\* /
), but that replaces the first asterisk, not the last. I feel like I'm really close but there's something I'm missing that will make this clear.