zeros on the left if needed. Ideally, Vim would provide a
right() function where you could just do something like
right('0'.submatch(1), 2)
to zero-pad to 2 places. Alas, the substitute() trick is the
easiest way I've found to simulate this.
repeat('0', 2 - strlen(submatch(1))) . submatch(1)
A slight step in the right direction. Two caveats, however:
1) if strlen(submatch(1)) > 2 (in other cases, not this
particular one where it's limited to at most 2 characters
initially), then this formula can end up with a result that is >
2 characters. A true right() function would never return more
than 2 characters (okay...insert funky tangent about
unicode/UTF-8 characters here).
2) the repeat() function was only added in v7, so it doesn't work
for those running older versions (e.g. Debian folks such as
myself for whom their "stable" repository progresses like syrup)
-tim