I neglected to mention that grep uses "basic regular expressions". Use 'egrep' 
for full regular expression matching. (or grep -E). 
 
I meant to say '/s' doesn't work in grep as a whitespace matching character, 
not '/w'. 
 


________________________________

From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
Sent: Thu 12/14/2006 9:36 AM
To: Dan Mergens
Cc: Naim Far; vim@vim.org
Subject: Re: grep and regular expression



Dan Mergens wrote:
> Vim does not use strict regular expressions and grep does not use regular 
> expressions for pattern matching.
> 
> The regular expression 'class\s*\w\+{' would have to match something like 
> this:
> 
> class   ALPHAJunk+{
> 
> which I don't think is representative of any class declaration I've seen.
> 
> You probably want 'class.+{' which will make any characters (including ':') 
> up to the '{'
> 
> class myClass : public parent {
> 
> Hope this helps
> 
> BTW - I could never get '\w' to match anything on Linux - I didn't see 
> anything regarding the use of that as a control character for whitespace 
> matching.

To match whitespace in Wim, use \s
\w matches "word" characters -- letters, digits and underscore.
In "normal" Vim regular expressions, + matches the plus sign while \+
multiplies the previous atom by "one or more".

See
        :help 'iskeyword'
        :help pattern-overview
and scroll up and down a few pages.

Best regards,
Tony.
       


Reply via email to