On Wed, Apr 13, 2011 at 07:08:06PM -0500, Tim Chase wrote:
> On 04/13/2011 05:17 PM, Benjamin R. Haskell wrote:
>> On Wed, 13 Apr 2011, Scottb wrote:
>>
>>> I suppose that would mean [...] "\d+\s\d+\sR" [...]
>>>
>>> BTW... just noticing that characters classes (like "\d" for digits)
>>> don't seem to work in regular Vim "/" searches, is that really the
>>> case?
>>
>> It's that you need to make the '+' "magic".  That one trips me up allll
>> the time.  (Less and less, but still often.)
> [snip]
>> /\d\+\s\d\+\sR
>
> It trips me up regularly as well, but in the opposite direction.  I use 
> Vim so much that I get stung having to check when writing regexps in sed 
> or Perl/Python regexps (I'm forever adding extraneous "\" before my "+" 
> in Python...why don't my $%^&* Python regexps work?!?!  Oh...I'm vimming 
> them :)

Tim, have you tried using /\v to start all regexes in Vim?
That pushes Vim's weird regex dialect closer to POSIX, thus helping
preserve sanity.

Although it isn't explicitly listed in the table at ":h \v", "+" is then
magic, as covered by the help item's initial statement.

It also reduces the number of backslashes in most regexes, I find.

Now if only there were a config switch to make that the norm! ;-)

Erik

-- 
Habit is habit, and not to be flung out of the window by any man, but
coaxed down-stairs a step at a time.
                         -- Mark Twain, "Pudd'nhead Wilson's Calendar

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to