regexvimtextalignmenttabular

How to align at/after last pattern occurence?


Example:

this is my text, this is, this is my text
this, this is my, this is my, this is text
this is, my text, this is, this is my text
this, this is my, this is my, this is text  

Normally, I use Tabular plugin to align text.
P.e. to align at the 1st or 2nd occurence of ','
I use this formule:

Tabularize /^\(.\{-}\zs,\)\{1}/l0
Tabularize /^\(.\{-}\zs,\)\{2}/l0

and to align after the 1st or 2nd occurence of ','

Tabularize /^\(.\{-}\zs,\)\{1}\zs/l0l1
Tabularize /^\(.\{-}\zs,\)\{2}\zs/l0l1

But how do I align *at and after the LAST occurence * of ','
if I don't know how many occurences there are?


Solution

  • I think in vim the last occurrence of a , would be matched with .*\zs,.

    So you should be able to issue a command like Tabularize /.*\zs,/