Today I Learned

hashrocket A Hashrocket project

Vim Regex Word Boundaries

Today while writing a Vim regex to change every instance of it (ignoring larger matches like itemized), we stumbled upon Vim regex word boundary matching.

Given this file:


The following Vim regex will match on both the first and second line:


But with word boundaries, we'll only match (and change) the first line, because only the first foo is a standalone word:

See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.