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

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

Re: Regarding replacing regexp


From: shirish
Subject: Re: Regarding replacing regexp
Date: Sat, 12 May 2012 16:09:30 +0530

Thanks Demiz.


On Thu, May 10, 2012 at 9:56 PM, Deniz Dogan <deniz@dogan.se> wrote:
On 2012-05-10 11:37, shirish wrote:
Hi,

I am in the process of learning how to use emacs. I know about the
replace-regexp but I am unable to create a regular _expression_ to do the
below.
Any help is much appreciated.

public static final String SUCCESS //Successmesg
public static final String FAILURE  //failuremessage

I need to replace that with

public static final String SUCCESS = "SUCCESS";//Successmesg
public static final String FAILURE  = "FAILURE"; //failuremessage

Thanks,
Shirish.



There are a lot of ways to do it.  One could be:

String \([^ ]+\)

and replace it with:

String \1 = "\1"

I would personally use keyboard macros for it.

I hope that helps,
Deniz


reply via email to

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