On 2010-05-18, Shawn H Corey wrote:
> On 10-05-18 02:33 PM, AK wrote:
> >On 05/18/2010 02:23 PM, Jeremiah Martell wrote:
> >>I cant figure out how to search for "newline followed by non-newline" 
> >>using
> >>vim.
> >>
> >>So if I have a file like this:
> >>
> >>a b c
> >>d e f
> >>g
> >>
> >>h i j
> >>k l
> >>
> >>m n o
> >>p q
> >>
> >>I want to find the newlines after c, f, j, and o, but not after g or l.
> >>
> >>What's the regular expression look like for this?
> >>
> >>Thanks,
> >>  - Jeremiah
> >>
> >>
> >
> >Doesn't /c\n work for you? -ak
> >
> 
> Unless he's using Windoze.  Then:
> 
> /c\r\n
> 
> For both:
> 
> /c\r\?\n
> 
> For the above:
> 
> /[cfjo]\r\?\n
> 
> Or, if c, f, j, and o are not single characters but strings:
> 
> /\(c\|f\|j\|o\)\r\?\n

It doesn't matter whether or not he's using Windows provided that
the file uses only NL line terminators or only CR-NL line
terminators.  As long as the line terminators are purely one type or
the other, Vim sets 'fileformat' accordingly and lets the line
terminator be represented by \n in patterns and by \r in
replacements.

Regards,
Gary

-- 
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