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

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

Re: Regarding replacing regexp


From: Deniz Dogan
Subject: Re: Regarding replacing regexp
Date: Thu, 10 May 2012 18:26:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

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]