Using Regular Expressions in Vim's Replace


That's right, I'm using Vim again. I talk myself into going back to Sublime Text 2 from time to time, but then realize I miss Vim. One thing I felt Sublime was stronger at was find and replace and using regular expressions while you're at it. It turns out that it was just my lack of knowledge of Vim's find and replace functionality, including regular expressions support.

It's actually very easy to use regular expressions when finding and replacing with Vim:


That will replace any string of two numbers with "XX" throughout the current document. Sublime requires you to activate a "Regular expression" mode, but Vim allows you to simply start typing them. Check out for some intro tutorials on regexes. Also, you can take a look at my Beginner's Guide to Vim for tips on things I wish I would have known when I started using Vim.