[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: [vim] Line truncation substitution() regexp
From:       Piet Delport <pjd () 303 ! za ! net>
Date:       2002-12-11 15:47:07
[Download RAW message or body]


On Tue, 10 Dec 2002 at 14:26:25 -0500, Charles E. Campbell wrote:
> On Tue, Dec 10, 2002 at 08:06:40AM -0500, Steve Hall wrote:
>> Srinath Avadhanula wrote:
>>  > echo substitute(str, "\\(.\\{8}\\)[^\n]*\n", '\=submatch(1)."\n"', 'g')
>> 
>> Thanks, all work for me! (I am now 100% convinced the only difficult
>> part of regexps is the escaping part... to quote or to double-quote,
>> that is the question.)
>  ---------------------------------------------------------------------
> 
> IMHO its best to avoid the question -- use single quotes instead of
> double-quotes.
> 
>     echo substitute(str, '\(.\{8}\)[^\n]*\n', '\=submatch(1).'\n'', 'g')

...which doesn't work in this case, unfortunately, as substitute() needs
literal newlines in this case.  Not sure if it's a bug or not, though.

-- 
Piet Delport
Today's subliminal thought is:

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic