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

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

Re: Regarding replacing regexp


From: Peter Dyballa
Subject: Re: Regarding replacing regexp
Date: Fri, 11 May 2012 10:39:43 +0200

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]