----- Original Message ----- From: "Naim Far" <[EMAIL PROTECTED]>
To: <vim@vim.org>
Sent: Thursday, December 14, 2006 8:06 AM
Subject: grep and regular expression


 I'm writing C++ code, I'm trying to search for all class declaration via the 
following command:

:grep 'class\s*\w\+{' *.hpp

The command fails! although if I do search for the same expression, the search 
succeeds (in a specific file)!

When you invoke Vim's :grep command, Vim's regular expression engine is not used at all. Vim invokes the external grep command specified with the 'grepprg' option and parses the stdout from the grep command according to the 'grepformat' option.

:help grepprg
:help grepformat

If you want the matching to use Vim's regular expression dialect, you need to 
use :vimgrep.
:help vimgrep

Hope this helps,
   Brett S.



Reply via email to