[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regex replace
From: |
Gary Wessle |
Subject: |
Re: regex replace |
Date: |
12 Dec 2006 07:24:43 +1100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
"rgb" <rbielaws@i1.net> writes:
> Gary Wessle wrote:
> > Hi
> >
> > I need to remove the "//" from the beginning of all the lines in my
> > c++ code which contain the string 'n', including the single comma.
> > e.g, un-comment all of those lines that qualify. and then also to
> > place "//" not including the double quotes at the beginning of all
> > lines containing the 'f' string.
> >
> > this is a bit too much for me to come up with.
> >
> > thanks
>
> C-M-% ^\(//\)\(.*'n',\)<RET>\2<RET>
>
> C-M-% ^.*'f'<RET>//\0<RET>
// if( some switch->fd ) p_acc->sbs(a_f, morearg, somemore, 'n', 0); //
no action taken
the first command you posted will not work on the above, even after I
modified it to take the spaces at the start like this.
C-M-% ^ *\(//\)\(.*'n',\)<RET>\2<RET>