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

List:       vim
Subject:    Re: [vim] Line truncation substitution() regexp
From:       "Charles E. Campbell" <cec () gryphon ! gsfc ! nasa ! gov>
Date:       2002-12-10 19:26:25
[Download RAW message or body]

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

Regards,
C Campbell

-- 
        Charles E Campbell, Jr, PhD            _   __   __
        Goddard Space Flight Center           / /_/\_\_/ /
        cec@NgrOyphSon.gPsfAc.nMasa.gov      /_/  \/_//_/
  PGP public key: http://www.erols.com/astronaut/pgp.html
[prev in list] [next in list] [prev in thread] [next in thread] 

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