help-gnu-emacs
[Top][All Lists]
Advanced

[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 18:57:33 +1100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Malte Spiess <address@hidden> writes:

> Gary Wessle <address@hidden> writes:
> 
> > "rgb" <address@hidden> 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>
> 
> Hm, strange, works fine here!
> 
> Could you maybe tell us what was your output? 
 
something like 0 replaced.


>Are you sure you really
> did C-M-% and not M-% ? What other line did it work with?
> 

C-M-% does not work here.
GNU Emacs 21.4.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2006-03-07 on hs20-bc1-6.build.redhat.com

so I did M-x query-replace-regex 
I am still don't know why it did not fire.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]