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 2Level 1Would become:* Level 1** Level 2** Level 2*** Level 3** Level 2* Level 1I 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.
Replace last instance of character (and there's more)
regular expression;replace
Here's a solution I came up with::%s/^\(\t*\)/\=* . substitute(submatch(1), '\t', '\*', 'g') .  /%s///: Do a substitute on every line in the file^\(\t*\): Match as many tabs as you can find at the beginning of the line\=: Allows us to use an expression in the replacementsubstitute(submatch(1), '\t', '\*', 'g'): Replace all the tabs with asterisks. (The submatch(1) selects the the first group of memory parentheses \(\))* . ... .  : Prepend an asterisk and append a space characterSee :h submatch and :h sub-replace-\= for more info.