How do I get the length of a regex match in vim?

Posted by misfo on Stack Overflow See other posts from Stack Overflow or by misfo
Published on 2010-04-07T18:19:12Z Indexed on 2010/04/07 18:23 UTC
Read the original article Hit count: 297

Filed under:
|
|

If I want to get the length of each match within the parentheses in the following regex, how do I do it?:

^\(\-\+\s\)\+

I'm trying to modify the width of columns in a buffer with data that is laid out as a table. Since the first two rows of the table will look like this

 DESIGN_ID DESIGN_YEAR SOURCE_REFERENCE
---------- ----------- ----------------

I want to use the regular expression to find the current width of each column.

© Stack Overflow or respective owner

Related posts about vim

Related posts about vimscript