From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: shirish Newsgroups: gmane.emacs.help Subject: Re: Regarding replacing regexp Date: Sat, 12 May 2012 16:09:48 +0530 Message-ID: References: <28BA2A50-EFBF-4F14-96FB-F3CE37B8CBC6@Web.DE> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f2351b513291104bfd47a01 X-Trace: dough.gmane.org 1336819223 24597 80.91.229.3 (12 May 2012 10:40:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 May 2012 10:40:23 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Peter Dyballa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 12 12:40:23 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ST9kK-0000ps-SJ for geh-help-gnu-emacs@m.gmane.org; Sat, 12 May 2012 12:40:20 +0200 Original-Received: from localhost ([::1]:38917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9kK-0001K6-7n for geh-help-gnu-emacs@m.gmane.org; Sat, 12 May 2012 06:40:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9kE-0001Jn-18 for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:40:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ST9kB-0003Jc-6R for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:40:13 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:41646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9kA-0003JA-UN for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:40:11 -0400 Original-Received: by obbwd18 with SMTP id wd18so5650601obb.0 for ; Sat, 12 May 2012 03:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=7AKsTzjZ5/JBDQB2VZHXxCOMWYuF1VDGtEmQ78DVjR0=; b=Ja+QhKXFe53XbjLpzNNVOSs4Gby6o6pv27y6WTMWzI9IxiosSttVZllyJ5gtBDQg5i +l2s+F8W5Gx6YOTKPeHZxNXK8cObiD92W2eHUMfxVeio1R5cpjtvNMblvOumhFl0zUVe HhkQqjV0wIqtPOtvhF10e+HgVWAsqLAEV6oxesQ9o/i9fEnG8YeeWrKU7N8dhh030RhT nICwlPHwWCKhy3b005E8xUtEzfRiDFGLe0xdg9Yk3/14/lbHYAiM+jYGW51YN3Ag1+5z FTdLr4wS8XhKkmgPNTdiOx9BNKIkrmME7CY8F0EJei54gFhLIoAGLEbJvMmDPy7wNJIx huDA== Original-Received: by 10.50.169.5 with SMTP id aa5mr622488igc.48.1336819208890; Sat, 12 May 2012 03:40:08 -0700 (PDT) Original-Received: by 10.231.36.203 with HTTP; Sat, 12 May 2012 03:39:48 -0700 (PDT) In-Reply-To: <28BA2A50-EFBF-4F14-96FB-F3CE37B8CBC6@Web.DE> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84810 Archived-At: --e89a8f2351b513291104bfd47a01 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thanks Peter On Fri, May 11, 2012 at 2:09 PM, Peter Dyballa 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 =3D "SUCCESS";//Successmesg > > public static final String FAILURE =3D "FAILURE"; //failuremessage > > You could try: > > \(final \w+ \)\([A-Z]+\) -> \1\2 =3D "\2"; > > The text "final " followed by a sequence of upper-case letter= s > (\([A-Z]+\)) is found and saved in registers and substituted with the fir= st > finding followed by '=3D' and the found sequence of upper-case letters in > double quotation marks followed by ';'. The remainder of the original lin= e > stays unchanged. > > -- > Greetings > > Pete > > One cannot live by television, video games, top ten CDs, and dumb movies > alone. > =96 Amiri Baraka, 1999 > > --e89a8f2351b513291104bfd47a01 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thanks Peter


On Fri, May 11, 2012 at 2:09 PM, Peter D= yballa <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 =A0//failuremessage
>
> I need to replace that with
>
> public static final String SUCCESS =3D "SUCCESS";//Successme= sg
> public static final String FAILURE =A0=3D "FAILURE"; //failu= remessage

You could try:

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

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

--
Greetings

=A0Pete

One cannot live by television, video games, top ten CDs, and dumb movies al= one.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=96 Amiri B= araka, 1999


--e89a8f2351b513291104bfd47a01--