Search This Blog

Friday, February 11, 2011

Reminder: Regex "greedy" matching in gVIM

To remind myself -- when using gVIM, "greedy" matching doesn't use the "?" question mark character used in PERL but, instead, the string "\{-}". I need this about once every three months and completely forget what the string is -- well, here it is to remind me.

Example:

   [DoT PO Uninstall Number] [nvarchar](255) NULL
   :%s/^\[.\{-}\].*/\1/

results in:

   DoT PO Uninstall Number

From the best gVIM cheatsheet available: www.rayninfo.co.uk/vimtips.html

No comments: