Vim and Regular Expressions for removing redundant whitespace
Introduction and structure of the article I wrote this article to practice “in situ” formula construction of Regular Expressions , also called "RegEx", in Vim. In particular, the goal is to “clean up” documents with excess whitespace at both the beginning and end of each line. A basic knowledge of Vim and the Regular Expressions built into the editor is sufficient for understanding the article. The various formulas are applied to whole documents but, since they are very normal search commands in Vim, they can be applied to individual rows or to specific ranges of rows in the context of the document. There are three formulas illustrated and the construction is progressive with “step-by-step” analysis of the syntax of Regular Expressions . The structure of the article is as follows: first I illustrate the creation of the formula for an end-of-line operation; then I move on to the reverse formula, i.e., for the same operation but at the beginning of the line; finally ...