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:48 +0530

Thanks Peter


On Fri, May 11, 2012 at 2:09 PM, Peter Dyballa <Peter_Dyballa@web.de> wrote:

Am 10.05.2012 um 11:37 schrieb shirish:

> 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

You could try:

       \(final \w+ \)\([A-Z]+\) -> \1\2 = "\2";

The text "final <some word> " followed by a sequence of upper-case letters (\([A-Z]+\)) is found and saved in registers and substituted with the first finding followed by '=' and the found sequence of upper-case letters in double quotation marks followed by ';'. The remainder of the original line stays unchanged.

--
Greetings

 Pete

One cannot live by television, video games, top ten CDs, and dumb movies alone.
                               – Amiri Baraka, 1999



reply via email to

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