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:30 +0530 Message-ID: References: <4FABEC39.6060305@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae934104105493d04bfd47984 X-Trace: dough.gmane.org 1336819204 24493 80.91.229.3 (12 May 2012 10:40:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 May 2012 10:40:04 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Deniz Dogan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 12 12:40:03 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 1ST9k2-0000fN-Rk for geh-help-gnu-emacs@m.gmane.org; Sat, 12 May 2012 12:40:03 +0200 Original-Received: from localhost ([::1]:38214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9k2-0000sE-1p for geh-help-gnu-emacs@m.gmane.org; Sat, 12 May 2012 06:40:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9jv-0000s7-VK for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:39:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ST9ju-00037H-2Y for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:39:55 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:44615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ST9jt-000379-SA for help-gnu-emacs@gnu.org; Sat, 12 May 2012 06:39:54 -0400 Original-Received: by yenm7 with SMTP id m7so4124925yen.0 for ; Sat, 12 May 2012 03:39:51 -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=3Nto7nEWeQzmWM3iYEBzLxMyq8/zPGvvTsneZQ5hGpw=; b=fxQKpp6y61HJlPUuhxhJcSitJ7cKTsrhkmLFh/QBnp2MCHnHoB9L2P5ZhnUiAoVZmr fUouVBMwAhxGgZjj2XXu40vM1DPQgxMWnfzhXa+uKsrpLNg0gi/96tdoP7KTZwFv2Ecg cl1YqeznGaWG9bzPSuTq1H4PlyzriL4VNndj1KMKA7AcMF/APVjqEYJHIeY1cSYfbwwG RG3/w3LQl8Cz9j/rl6sHNuCd2AdS9kGxTYiseesD5mGu0EFeRsSR0bCuyr6Nlle2AOo6 LepuzNuCIx/nlmt7vPM5JM9phQYagBAqWIMNh49SllTNzwIxjUJNT/dfT0ugKvxZuUvF Q2NQ== Original-Received: by 10.50.46.228 with SMTP id y4mr778361igm.10.1336819191203; Sat, 12 May 2012 03:39:51 -0700 (PDT) Original-Received: by 10.231.36.203 with HTTP; Sat, 12 May 2012 03:39:30 -0700 (PDT) In-Reply-To: <4FABEC39.6060305@dogan.se> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.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:84809 Archived-At: --14dae934104105493d04bfd47984 Content-Type: text/plain; charset=ISO-8859-1 Thanks Demiz. On Thu, May 10, 2012 at 9:56 PM, Deniz Dogan 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 > --14dae934104105493d04bfd47984 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Demiz.


On Thu, May 10, 2012 at 9:56 PM, Deniz D= ogan <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 =A0//failuremessage

I need to replace that with

public static final String SUCCESS =3D "SUCCESS";//Successmesg public static final String FAILURE =A0=3D "FAILURE"; //failuremes= sage

Thanks,
Shirish.



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

String \([^ ]+\)

and replace it with:

String \1 =3D "\1"

I would personally use keyboard macros for it.

I hope that helps,
Deniz

--14dae934104105493d04bfd47984--