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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regex replace


From: Malte Spiess
Subject: Re: regex replace
Date: Mon, 11 Dec 2006 21:51:58 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Gary Wessle <phddas@yahoo.com> writes:

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

Hm, strange, works fine here!

Could you maybe tell us what was your output? Are you sure you really
did C-M-% and not M-% ? What other line did it work with?

By the way, should there be no other occurances of 'n', this would also
be nice for a macro...

Greetings

Malte


reply via email to

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