Regular expressions in VIM

An issue I often stumble across in VIM is the regular expression syntax (or “patterns” in VIM speak).

The main difference to other regular expression implementations is that some special meta-character have to be escaped to give them their special meaning. Its just the other way around; usually you would escape them to match the character itself.

Example: To match one ore more occurences of a digit you would normallry would write “\d+”. But in VIM you have to write “\d\+d” instead. This is also true for “\?” and “\{\}” patterns. See vim documenatation for more such patterns.

The behaviour can slightly be modified with the magic option.